class Izokatu::Openssl::PublicKey::RSA::Decrypter
OpenSSL public key RSA
decrypter
Attributes
private_key[R]
@return [String] private key string for decryption
Public Class Methods
new(encrypted_data:, private_key:)
click to toggle source
Initialize options for OpenSSL RSA
decryption
@param encrypted_data (encrypted_data
) @param private_key
(private_key
)
@since 0.1.0
Calls superclass method
Izokatu::Decrypter::new
# File lib/izokatu/openssl/public_key/rsa/decrypter.rb, line 19 def initialize(encrypted_data:, private_key:) super(encrypted_data: encrypted_data) initialize_private_key!(private_key) end
Private Instance Methods
decrypt_data!()
click to toggle source
Decrypting data
@return [Hash] decrypted data
@since 0.1.0
# File lib/izokatu/openssl/public_key/rsa/decrypter.rb, line 46 def decrypt_data! { decrypted_data_string: private_key.private_decrypt(encrypted_data) } end
initialize_private_key!(private_key)
click to toggle source
Initialize RSA
private key from private key string
@param private_key
(private_key
)
@return [OpenSSL:PKey::RSA] OpenSSL private key instance
@since 0.1.0
# File lib/izokatu/openssl/public_key/rsa/decrypter.rb, line 34 def initialize_private_key!(private_key) raise 'ERROR: No private key!' unless private_key @private_key = OpenSSL::PKey.read(private_key) end