Class: Puppet::SSL::CertificateSigner Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/ssl/certificate_signer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Take care of signing a certificate in a FIPS 140-2 compliant manner.

Instance Method Summary collapse

Constructor Details

#initializeCertificateSigner

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CertificateSigner.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/puppet/ssl/certificate_signer.rb', line 7

def initialize
  if OpenSSL::Digest.const_defined?('SHA256')
    @digest = OpenSSL::Digest::SHA256
  elsif OpenSSL::Digest.const_defined?('SHA1')
    @digest = OpenSSL::Digest::SHA1
  else
    raise Puppet::Error,
      "No FIPS 140-2 compliant digest algorithm in OpenSSL::Digest"
  end
  @digest
end

Instance Method Details

#sign(content, key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/puppet/ssl/certificate_signer.rb', line 19

def sign(content, key)
  content.sign(key, @digest.new)
end