瀏覽代碼

Include fingerprint certificate

new-scoring
aeris 2 年之前
父節點
當前提交
8d3c33d516
共有 2 個檔案被更改,包括 12 行新增5 行删除
  1. 6
    5
      lib/cryptcheck/tls/cert.rb
  2. 6
    0
      lib/cryptcheck/tls/fixture.rb

+ 6
- 5
lib/cryptcheck/tls/cert.rb 查看文件

@@ -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,

+ 6
- 0
lib/cryptcheck/tls/fixture.rb 查看文件

@@ -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

Loading…
取消
儲存