From eabb345e029d813de9a4cb13c3df5e1d360a6462 Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Sat, 29 Aug 2026 22:31:15 +0200 Subject: [PATCH] Validate RSA key algorithm for RSA-PSS --- lib/cose/algorithm/rsa_pss.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cose/algorithm/rsa_pss.rb b/lib/cose/algorithm/rsa_pss.rb index bfe887c..2334272 100644 --- a/lib/cose/algorithm/rsa_pss.rb +++ b/lib/cose/algorithm/rsa_pss.rb @@ -21,7 +21,9 @@ def initialize(*args, hash_function:, salt_length:) private def valid_key?(key) - to_cose_key(key).is_a?(COSE::Key::RSA) + cose_key = to_cose_key(key) + + cose_key.is_a?(COSE::Key::RSA) && (!cose_key.alg || cose_key.alg == id) end def signature_algorithm_class