Class: EC::Signature
- Inherits:
-
Object
- Object
- EC::Signature
- Defined in:
- lib/elliptic.rb
Instance Attribute Summary collapse
-
#r ⇒ Object
readonly
Returns the value of attribute r.
-
#s ⇒ Object
readonly
Returns the value of attribute s.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(r, s) ⇒ Signature
constructor
A new instance of Signature.
- #to_der ⇒ Object
Constructor Details
#initialize(r, s) ⇒ Signature
Returns a new instance of Signature.
25 26 27 |
# File 'lib/elliptic.rb', line 25 def initialize(r, s) @r, @s = r, s end |
Instance Attribute Details
#r ⇒ Object (readonly)
Returns the value of attribute r.
24 25 26 |
# File 'lib/elliptic.rb', line 24 def r @r end |
#s ⇒ Object (readonly)
Returns the value of attribute s.
24 25 26 |
# File 'lib/elliptic.rb', line 24 def s @s end |
Class Method Details
.decode_der(der) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/elliptic.rb', line 17 def self.decode_der( der ) asn1 = OpenSSL::ASN1.decode(der ) r = asn1.value[0].value.to_i s = asn1.value[1].value.to_i new(r, s) end |
Instance Method Details
#to_der ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/elliptic.rb', line 29 def to_der asn1 = OpenSSL::ASN1::Sequence.new [ OpenSSL::ASN1::Integer.new( @r ), OpenSSL::ASN1::Integer.new( @s ), ] asn1.to_der end |