Class: CryptoGost3410::Verifier
- Inherits:
-
Object
- Object
- CryptoGost3410::Verifier
- Defined in:
- lib/crypto_gost3410/verifier.rb
Overview
DigitalSignature
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
Instance Method Summary collapse
-
#initialize(group) ⇒ Verifier
constructor
A new instance of Verifier.
- #verify(hash, public_key, signature) ⇒ Object
Constructor Details
#initialize(group) ⇒ Verifier
Returns a new instance of Verifier.
8 9 10 |
# File 'lib/crypto_gost3410/verifier.rb', line 8 def initialize(group) @group = group end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
6 7 8 |
# File 'lib/crypto_gost3410/verifier.rb', line 6 def group @group end |
Instance Method Details
#verify(hash, public_key, signature) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/crypto_gost3410/verifier.rb', line 12 def verify(hash, public_key, signature) @public_key = public_key r = signature.x s = signature.y return false if invalid_vector?(r) || invalid_vector?(s) (c_param(hash, public_key, r, s).x % group.order) == r end |