diff options
author | azul <azul@leap.se> | 2014-05-26 10:08:07 +0200 |
---|---|---|
committer | azul <azul@leap.se> | 2014-05-26 10:08:07 +0200 |
commit | df298887221cffc8cacc8965d73a0d7850118849 (patch) | |
tree | e13fc7c05956b10ca051377b89487d97e659528d /app/models/client_certificate.rb | |
parent | 0f686b1256b4190522bcb101ba06cd2c7406eb36 (diff) | |
parent | f221e5313fe54a2efa127b547916c7c812110449 (diff) |
Merge pull request #165 from azul/feature/cert-fingerprints
Feature/cert fingerprints
Diffstat (limited to 'app/models/client_certificate.rb')
-rw-r--r-- | app/models/client_certificate.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/client_certificate.rb b/app/models/client_certificate.rb index 76b07a2..63de9e1 100644 --- a/app/models/client_certificate.rb +++ b/app/models/client_certificate.rb @@ -43,8 +43,16 @@ class ClientCertificate self.key.to_pem + self.cert.to_pem end + def fingerprint + OpenSSL::Digest::SHA1.hexdigest(openssl_cert.to_der).scan(/../).join(':') + end + private + def openssl_cert + cert.openssl_body + end + def self.root_ca @root_ca ||= begin crt = File.read(APP_CONFIG[:client_ca_cert]) |