Class: NemID::Crypto
- Inherits:
-
Object
- Object
- NemID::Crypto
- Defined in:
- lib/nemid/crypto.rb
Instance Method Summary collapse
- #base64_encoded_der_representation ⇒ Object
- #base64_encoded_digest_representation(data) ⇒ Object
- #base64_encoded_rsa_signature(data) ⇒ Object
- #get_certificate ⇒ Object
- #get_key ⇒ Object
-
#initialize(cert:, key:) ⇒ Crypto
constructor
A new instance of Crypto.
Constructor Details
#initialize(cert:, key:) ⇒ Crypto
Returns a new instance of Crypto.
6 7 8 9 |
# File 'lib/nemid/crypto.rb', line 6 def initialize(cert:, key:) @certificate = read_x509(cert) @rsa_instance = rsa_keypair(key) end |
Instance Method Details
#base64_encoded_der_representation ⇒ Object
11 12 13 |
# File 'lib/nemid/crypto.rb', line 11 def base64_encoded_der_representation Base64.strict_encode64(@certificate.to_der) end |
#base64_encoded_digest_representation(data) ⇒ Object
15 16 17 |
# File 'lib/nemid/crypto.rb', line 15 def base64_encoded_digest_representation(data) Base64.strict_encode64(digest(data)) end |
#base64_encoded_rsa_signature(data) ⇒ Object
19 20 21 |
# File 'lib/nemid/crypto.rb', line 19 def base64_encoded_rsa_signature(data) Base64.strict_encode64(sign(data)) end |
#get_certificate ⇒ Object
23 24 25 |
# File 'lib/nemid/crypto.rb', line 23 def get_certificate @certificate end |
#get_key ⇒ Object
27 28 29 |
# File 'lib/nemid/crypto.rb', line 27 def get_key @rsa_instance end |