This will become a rails application as client for LXD.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
464 B

require "openssl"
require 'digest/md5'
class Certificate < ActiveRecord::Base
def key
OpenSSL::PKey::EC.new read_attribute(:key) if read_attribute(:key)
end
def cert
OpenSSL::X509::Certificate.new read_attribute(:cert) if read_attribute(:cert)
end
def key_fpr
Digest::SHA256.hexdigest(key.to_der).upcase
end
def cert_fpr
Digest::SHA256.hexdigest(cert.to_der).upcase
end
private
def _key
end
end
# vim: set et ts=2 sw=2: