Class: Linzer::RSAPSS::Key
Overview
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
-
#private? ⇒ Boolean
True if this key contains private key material.
-
#public? ⇒ Boolean
True if this key contains public key material.
-
#sign(data) ⇒ String
Signs data using RSA-PSS.
- #validate ⇒ Object private
-
#verify(signature, data) ⇒ Boolean
Verifies an RSA-PSS signature.
Methods inherited from Key
Constructor Details
This class inherits a constructor from Linzer::Key
Instance Method Details
#private? ⇒ Boolean
Returns true if this key contains private key material.
74 75 76 |
# File 'lib/linzer/rsa_pss.rb', line 74 def private? has_pem_private? end |
#public? ⇒ Boolean
Returns true if this key contains public key material.
69 70 71 |
# File 'lib/linzer/rsa_pss.rb', line 69 def public? has_pem_public? end |
#sign(data) ⇒ String
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 |