Sha256: aa40882b931540d0b4d3d638b006a7fb1cec73c3c5284c6ad368b92f3f6a3e0f

Contents?: true

Size: 602 Bytes

Versions: 5

Compression:

Stored size: 602 Bytes

Contents

# frozen_string_literal: true

class Acme::Client::Resources::Challenges::TLSSNI01 < Acme::Client::Resources::Challenges::Base
  CHALLENGE_TYPE = 'tls-sni-01'.freeze
  DIGEST = OpenSSL::Digest::SHA256

  def hostname
    digest = DIGEST.hexdigest(authorization_key)
    "#{digest[0..31]}.#{digest[32..64]}.acme.invalid"
  end

  def certificate
    self_sign_certificate.certificate
  end

  def private_key
    self_sign_certificate.private_key
  end

  private

  def self_sign_certificate
    @self_sign_certificate ||= Acme::Client::SelfSignCertificate.new(subject_alt_names: [hostname])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acme-client-1.0.0 lib/acme/client/resources/challenges/tls_sni01.rb
acme-client-0.6.3 lib/acme/client/resources/challenges/tls_sni01.rb
acme-client-0.6.2 lib/acme/client/resources/challenges/tls_sni01.rb
acme-client-0.6.1 lib/acme/client/resources/challenges/tls_sni01.rb
acme-client-0.6.0 lib/acme/client/resources/challenges/tls_sni01.rb