From 647253b37092c3a58637ef35809bb3912de3279c Mon Sep 17 00:00:00 2001 From: Adam Lippai Date: Wed, 27 Jun 2018 14:59:12 +0200 Subject: [PATCH] Add one more RSA PSS test --- test/rsa.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/rsa.js b/test/rsa.js index 19a61a2..bdd12be 100644 --- a/test/rsa.js +++ b/test/rsa.js @@ -113,6 +113,15 @@ describe('RSA-PSS-SHA256', () => { expect(() => rsaPssVerify.verify(signature, asmCrypto.string_to_bytes(text))).to.throw; }); + it('asmCrypto.RSA_PSS_SHA256 sign/verify with default salt length mismatch', function() { + const text = 'HelloWorld!HelloWorld!HelloWorld!HelloWorld!HelloWorld!HelloWorld!HelloWorld!HelloWorld!'; + const rsaPssSign = new asmCrypto.RSA_PSS(privkey, new asmCrypto.Sha256(), 32); + const rsaPssVerify = new asmCrypto.RSA_PSS(pubKey, new asmCrypto.Sha256()); + + const signature = rsaPssSign.sign(asmCrypto.string_to_bytes(text)); + expect(() => rsaPssVerify.verify(signature, asmCrypto.string_to_bytes(text))).to.throw; + }); + it('asmCrypto.RSA_PSS_SHA512 sign/verify', function() { const text = 'HelloWorld!HelloWorld!HelloWorld!HelloWorld!HelloWorld!HelloWorld!HelloWorld!HelloWorld!'; const rsaPssSign = new asmCrypto.RSA_PSS(privkey, new asmCrypto.Sha512());