Class: PrivateKeyStore
- Inherits:
-
Object
- Object
- PrivateKeyStore
- Defined in:
- lib/letsencrypt_plugin/private_key_store.rb
Instance Method Summary collapse
-
#initialize(private_key) ⇒ PrivateKeyStore
constructor
A new instance of PrivateKeyStore.
- #retrieve ⇒ Object
Constructor Details
#initialize(private_key) ⇒ PrivateKeyStore
Returns a new instance of PrivateKeyStore.
4 5 6 7 8 9 |
# 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 |
Instance Method Details
#retrieve ⇒ Object
11 12 13 14 15 16 17 |
# 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 |