Method: Puppet::SSL::Base#digest_algorithm

Defined in:
lib/puppet/ssl/base.rb

#digest_algorithmObject



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/puppet/ssl/base.rb', line 124

def digest_algorithm
  # The signature_algorithm on the X509 cert is a combination of the digest
  # algorithm and the encryption algorithm
  # e.g. md5WithRSAEncryption, sha256WithRSAEncryption
  # Unfortunately there isn't a consistent pattern
  # See RFCs 3279, 5758
  digest_re = Regexp.union(
    /ripemd160/i,
    /md[245]/i,
    /sha\d*/i
  )
  ln = content.signature_algorithm
  match = digest_re.match(ln)
  if match
    match[0].downcase
  else
    raise Puppet::Error, _("Unknown signature algorithm '%{ln}'") % { ln: ln }
  end
end