Include fingerprint certificate

new-scoring
aeris 2017-04-11 12:56:02 +02:00
parent b6055e7d90
commit 8d3c33d516
2 changed files with 12 additions and 5 deletions

View File

@ -88,7 +88,7 @@ module CryptCheck
end
def fingerprint
::OpenSSL::Digest::SHA256.hexdigest @cert.to_der
@cert.fingerprint
end
def key
@ -120,10 +120,11 @@ module CryptCheck
fingerprint: self.fingerprint,
chain: @chain.collect do |cert|
{
subject: cert.subject.to_s,
serial: cert.serial.to_s,
issuer: cert.issuer.to_s,
lifetime: { not_before: cert.not_before, not_after: cert.not_after }
subject: cert.subject.to_s,
serial: cert.serial.to_s,
issuer: cert.issuer.to_s,
fingerprint: cert.fingerprint,
lifetime: { not_before: cert.not_before, not_after: cert.not_after }
}
end,
key: self.key.to_h,

View File

@ -150,6 +150,12 @@ class ::OpenSSL::PKey::DH
end
end
class ::OpenSSL::X509::Certificate
def fingerprint
::OpenSSL::Digest::SHA256.hexdigest self.to_der
end
end
class ::OpenSSL::X509::Store
def add_chains(chains)
chains = [chains] unless chains.is_a? Enumerable