Class: EBICS::Key
- Inherits:
-
Object
- Object
- EBICS::Key
- Defined in:
- lib/ebics.rb
Instance Attribute Summary collapse
- #created_at ⇒ Object
-
#rsa ⇒ Object
Returns the value of attribute rsa.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type) ⇒ Key
constructor
A new instance of Key.
- #public_exponent ⇒ Object
- #public_modulus ⇒ Object
- #public_sha_256 ⇒ Object
Constructor Details
#initialize(type) ⇒ Key
Returns a new instance of Key.
80 81 82 |
# File 'lib/ebics.rb', line 80 def initialize(type) @type = type end |
Instance Attribute Details
#created_at ⇒ Object
100 101 102 |
# File 'lib/ebics.rb', line 100 def created_at @created_at.iso8601(10) end |
#rsa ⇒ Object
Returns the value of attribute rsa.
77 78 79 |
# File 'lib/ebics.rb', line 77 def rsa @rsa end |
#type ⇒ Object
Returns the value of attribute type.
77 78 79 |
# File 'lib/ebics.rb', line 77 def type @type end |
Instance Method Details
#public_exponent ⇒ Object
88 89 90 |
# File 'lib/ebics.rb', line 88 def public_exponent Base64.strict_encode64(@rsa.public_key.e.to_s(2)) end |
#public_modulus ⇒ Object
84 85 86 |
# File 'lib/ebics.rb', line 84 def public_modulus Base64.strict_encode64(@rsa.public_key.n.to_s(16)) end |
#public_sha_256 ⇒ Object
92 93 94 95 96 97 98 |
# File 'lib/ebics.rb', line 92 def public_sha_256 public_key_string = "#{ @rsa.public_key.e.to_s(16).downcase } #{ @rsa.public_key.n.to_s(16).downcase }" public_key_string.gsub! /\A0/, '' puts public_key_string public_key_string.encode!('US-ASCII') Digest::SHA256.hexdigest(public_key_string) end |