class PrivateKeyStore
Public Class Methods
new(private_key)
click to toggle source
# File lib/letsencrypt_plugin/private_key_store.rb, line 4 def initialize(private_key) # this should eventually be any one of many backends? # these could then encapsulate the method of retrieving the # RSA key string. see: http://hawkins.io/2013/10/implementing_the_repository_pattern/ @private_key = private_key end
Public Instance Methods
retrieve()
click to toggle source
# File lib/letsencrypt_plugin/private_key_store.rb, line 11 def retrieve pk = OpenSSL::PKey::RSA.new(@private_key) raise "Invalid key size: #{pk.n.num_bits}. Required size is between 2048 - 4096 bits" unless valid_key_size?(pk) pk rescue OpenSSL::PKey::RSAError raise "#{pk} is not a valid private key identifier" end
Private Instance Methods
valid_key_size?(key)
click to toggle source
# File lib/letsencrypt_plugin/private_key_store.rb, line 21 def valid_key_size?(key) key.n.num_bits >= 2048 && key.n.num_bits <= 4096 end