Class: EBICS::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/ebics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_atObject



100
101
102
# File 'lib/ebics.rb', line 100

def created_at
  @created_at.iso8601(10)
end

#rsaObject

Returns the value of attribute rsa.



77
78
79
# File 'lib/ebics.rb', line 77

def rsa
  @rsa
end

#typeObject

Returns the value of attribute type.



77
78
79
# File 'lib/ebics.rb', line 77

def type
  @type
end

Instance Method Details

#public_exponentObject



88
89
90
# File 'lib/ebics.rb', line 88

def public_exponent
  Base64.strict_encode64(@rsa.public_key.e.to_s(2))
end

#public_modulusObject



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_256Object



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