Class: Linzer::RSAPSS::Key
Overview
Note:
RSA-PSS signatures are non-deterministic due to random salt. The same data signed twice will produce different signatures, but both will verify successfully.
RSA-PSS signing key implementation.
Uses the ‘rsa-pss-sha512` algorithm identifier with a 64-byte salt.
Instance Attribute Summary
Attributes inherited from Key
Instance Method Summary collapse
-
#sign(data) ⇒ String
Signs data using RSA-PSS.
- #validate ⇒ Object private
-
#verify(signature, data) ⇒ Boolean
Verifies an RSA-PSS signature.
Methods inherited from Key
#initialize, #key_id, #private?, #public?
Constructor Details
This class inherits a constructor from Linzer::Key
Instance Method Details
#sign(data) ⇒ String
Note:
The signature is non-deterministic due to random PSS salt.
Signs data using RSA-PSS.
47 48 49 50 |
# File 'lib/linzer/rsa_pss.rb', line 47 def sign(data) validate_signing_key material.sign(@params[:digest], data, ) end |
#validate ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 |
# File 'lib/linzer/rsa_pss.rb', line 35 def validate super validate_digest end |
#verify(signature, data) ⇒ Boolean
Verifies an RSA-PSS signature.
58 59 60 61 62 63 64 65 66 |
# File 'lib/linzer/rsa_pss.rb', line 58 def verify(signature, data) validate_verify_key material.verify( @params[:digest], signature, data, ) end |