@@ -167,7 +167,7 @@ describe("polyfill", function () {
167
167
} ) ;
168
168
} ) ;
169
169
describe ( "sign" , function ( ) {
170
- it ( "performs RSASSA-PKCS1-v1_5 sign correctly" , function ( ) {
170
+ it ( "performs RSA-PSS sign correctly" , function ( ) {
171
171
const { publicKey, privateKey } = crypto . generateKeyPairSync ( "rsa" , {
172
172
modulusLength : 2048 ,
173
173
publicKeyEncoding : {
@@ -182,7 +182,7 @@ describe("polyfill", function () {
182
182
const data = ccf . strToBuf ( "foo" ) ;
183
183
const signature = ccf . crypto . sign (
184
184
{
185
- name : "RSASSA-PKCS1-v1_5 " ,
185
+ name : "RSA-PSS " ,
186
186
hash : "SHA-256" ,
187
187
} ,
188
188
privateKey ,
@@ -198,6 +198,7 @@ describe("polyfill", function () {
198
198
{
199
199
key : publicKey ,
200
200
dsaEncoding : "ieee-p1363" ,
201
+ padding : crypto . constants . RSA_PKCS1_PSS_PADDING ,
201
202
} ,
202
203
new Uint8Array ( signature ) ,
203
204
) ,
@@ -208,7 +209,7 @@ describe("polyfill", function () {
208
209
assert . isTrue (
209
210
ccf . crypto . verifySignature (
210
211
{
211
- name : "RSASSA-PKCS1-v1_5 " ,
212
+ name : "RSA-PSS " ,
212
213
hash : "SHA-256" ,
213
214
} ,
214
215
publicKey ,
@@ -392,20 +393,21 @@ describe("polyfill", function () {
392
393
} ) ;
393
394
} ) ;
394
395
describe ( "verifySignature" , function ( ) {
395
- it ( "performs RSASSA-PKCS1-v1_5 validation correctly" , function ( ) {
396
+ it ( "performs RSA-PSS validation correctly" , function ( ) {
396
397
const { cert, publicKey, privateKey } = generateSelfSignedCert ( ) ;
397
398
const signer = crypto . createSign ( "sha256" ) ;
398
399
const data = ccf . strToBuf ( "foo" ) ;
399
400
signer . update ( new Uint8Array ( data ) ) ;
400
401
signer . end ( ) ;
401
402
const signature = signer . sign ( {
402
403
key : crypto . createPrivateKey ( privateKey ) ,
403
- padding : crypto . constants . RSA_PKCS1_PADDING ,
404
+ padding : crypto . constants . RSA_PKCS1_PSS_PADDING ,
405
+ saltLength : 0 ,
404
406
} ) ;
405
407
assert . isTrue (
406
408
ccf . crypto . verifySignature (
407
409
{
408
- name : "RSASSA-PKCS1-v1_5 " ,
410
+ name : "RSA-PSS " ,
409
411
hash : "SHA-256" ,
410
412
} ,
411
413
cert ,
@@ -416,7 +418,7 @@ describe("polyfill", function () {
416
418
assert . isTrue (
417
419
ccf . crypto . verifySignature (
418
420
{
419
- name : "RSASSA-PKCS1-v1_5 " ,
421
+ name : "RSA-PSS " ,
420
422
hash : "SHA-256" ,
421
423
} ,
422
424
publicKey ,
@@ -427,7 +429,7 @@ describe("polyfill", function () {
427
429
assert . isNotTrue (
428
430
ccf . crypto . verifySignature (
429
431
{
430
- name : "RSASSA-PKCS1-v1_5 " ,
432
+ name : "RSA-PSS " ,
431
433
hash : "SHA-256" ,
432
434
} ,
433
435
cert ,
@@ -494,7 +496,7 @@ describe("polyfill", function () {
494
496
assert . throws ( ( ) =>
495
497
ccf . crypto . verifySignature (
496
498
{
497
- name : "RSASSA-PKCS1-v1_5 " ,
499
+ name : "RSA-PSS " ,
498
500
hash : "SHA-256" ,
499
501
} ,
500
502
publicKey ,
@@ -543,7 +545,7 @@ describe("polyfill", function () {
543
545
assert . throws ( ( ) =>
544
546
ccf . crypto . verifySignature (
545
547
{
546
- name : "RSASSA-PKCS1-v1_5 " ,
548
+ name : "RSA-PSS " ,
547
549
hash : "SHA-256" ,
548
550
} ,
549
551
publicKey ,
0 commit comments