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.
 
 
 
 
 
 

21 lines
432 B

require "openssl"
require 'digest/md5'
class Certificate < ActiveRecord::Base
def key
OpenSSL::PKey::RSA.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::SHA1.hexdigest(key.to_der).upcase
end
def cert_fpr
Digest::SHA1.hexdigest(cert.to_der).upcase
end
end
# vim: set et ts=2 sw=2: