Class: Sigstore::Internal::Key::RSA
- Inherits:
-
Sigstore::Internal::Key
- Object
- Sigstore::Internal::Key
- Sigstore::Internal::Key::RSA
- Defined in:
- lib/sigstore/internal/key.rb
Instance Attribute Summary
Attributes inherited from Sigstore::Internal::Key
Instance Method Summary collapse
-
#initialize ⇒ RSA
constructor
A new instance of RSA.
- #verify(_algo, signature, data) ⇒ Object
Methods inherited from Sigstore::Internal::Key
from_key_details, #public_to_der, read, #to_der, #to_pem
Methods included from Loggable
Constructor Details
#initialize ⇒ RSA
Returns a new instance of RSA.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/sigstore/internal/key.rb', line 113 def initialize(...) super raise ArgumentError, "key_type must be rsa, given #{@key_type}" unless @key_type == "rsa" unless @key.is_a?(OpenSSL::PKey::RSA) raise ArgumentError, "key must be an OpenSSL::PKey::RSA, given #{@key.inspect}" end case @schema when "rsassa-pss-sha256" raise Error::UnsupportedPlatform, "RSA-PSS verification unsupported" unless @key.respond_to?(:verify_pss) when "rsa-pkcs1v15-sha256" # supported else raise ArgumentError, "Unsupported schema #{schema}" end end |
Instance Method Details
#verify(_algo, signature, data) ⇒ Object
131 132 133 134 135 136 137 138 139 140 |
# File 'lib/sigstore/internal/key.rb', line 131 def verify(_algo, signature, data) case @schema when "rsassa-pss-sha256" @key.verify_pss("sha256", signature, data, salt_length: :auto, mgf1_hash: "SHA256") when "rsa-pkcs1v15-sha256" super else raise ArgumentError, "Unsupported schema #{schema}" end end |