lib/cose/algorithm/rsa_pss.rb in cose-0.10.0 vs lib/cose/algorithm/rsa_pss.rb in cose-0.11.0
- old
+ new
@@ -2,10 +2,11 @@
require "cose/algorithm/signature_algorithm"
require "cose/key/rsa"
require "cose/error"
require "openssl"
+require "openssl/signature_algorithm/rsapss"
module COSE
module Algorithm
class RSAPSS < SignatureAlgorithm
attr_reader :hash_function, :salt_length
@@ -15,25 +16,13 @@
@hash_function = hash_function
@salt_length = salt_length
end
- def compatible_key?(key)
- to_pkey(key)
- rescue COSE::Error
- false
- end
-
private
- def valid_signature?(key, signature, verification_data)
- pkey = to_pkey(key)
-
- if pkey.respond_to?(:verify_pss)
- pkey.verify_pss(hash_function, signature, verification_data, salt_length: :digest, mgf1_hash: hash_function)
- else
- raise(COSE::Error, "Update to openssl gem >= v2.1 to have RSA-PSS support")
- end
+ def signature_algorithm_class
+ OpenSSL::SignatureAlgorithm::RSAPSS
end
def to_pkey(key)
case key
when COSE::Key::RSA