@@ -306,6 +306,35 @@ function run_test() {
306
306
all_promises . push ( promise ) ;
307
307
} ) ;
308
308
309
+ // [RSA-PSS] Verification should fail with wrong saltLength
310
+ testVectors . forEach ( function ( vector ) {
311
+ if ( vector . algorithm . name === "RSA-PSS" ) {
312
+ var promise = importVectorKeys ( vector , [ "verify" ] , [ "sign" ] )
313
+ . then ( function ( vectors ) {
314
+ promise_test ( function ( test ) {
315
+ const saltLength = vector . algorithm . saltLength === 32 ? 48 : 32 ;
316
+ var operation = subtle . verify ( { ...vector . algorithm , saltLength } , vector . publicKey , vector . signature , vector . plaintext )
317
+ . then ( function ( is_verified ) {
318
+ assert_false ( is_verified , "Signature NOT verified" ) ;
319
+ } , function ( err ) {
320
+ assert_unreached ( "Verification should not throw error " + vector . name + ": " + err . message + "'" ) ;
321
+ } ) ;
322
+
323
+ return operation ;
324
+ } , vector . name + " verification failure with wrong saltLength" ) ;
325
+
326
+ } , function ( err ) {
327
+ // We need a failed test if the importVectorKey operation fails, so
328
+ // we know we never tested verification.
329
+ promise_test ( function ( test ) {
330
+ assert_unreached ( "importVectorKeys failed for " + vector . name + ". Message: ''" + err . message + "''" ) ;
331
+ } , "importVectorKeys step: " + vector . name + " verification failure with wrong saltLength" ) ;
332
+ } ) ;
333
+
334
+ all_promises . push ( promise ) ;
335
+ }
336
+ } ) ;
337
+
309
338
// Verification should fail with wrong plaintext
310
339
testVectors . forEach ( function ( vector ) {
311
340
var promise = importVectorKeys ( vector , [ "verify" ] , [ "sign" ] )
0 commit comments