diff --git a/security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptography.test.js b/security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptography.test.js index 336213023daa409809b2af74162f5fea0db4385f..9fcb56678f22efd176d40fbb458a0789b99782d0 100644 --- a/security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptography.test.js +++ b/security/cryptoFramework/js_api_test_one/src/main/js/test/AsymmetricCryptography.test.js @@ -404,6 +404,7 @@ export default function AsymmetricCryptographyJsunit() { let globalRsaKeyPair = rsaGenerator.generateKeyPair(); try { await cipherGeneratorEncrypt.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, globalRsaKeyPair, null); + expect(null).assertFail(); } catch (err) { console.error("err is:" + err.code); expect(err.code).assertEqual(401); diff --git a/security/cryptoFramework/js_api_test_one/src/main/js/test/DigestAlgorithm.test.js b/security/cryptoFramework/js_api_test_one/src/main/js/test/DigestAlgorithm.test.js index 7ae43e2cd156fe33f64a29fbd476cc87b431fd5c..998f33be24ca6413b29449d6121c9c03bc4806b4 100644 --- a/security/cryptoFramework/js_api_test_one/src/main/js/test/DigestAlgorithm.test.js +++ b/security/cryptoFramework/js_api_test_one/src/main/js/test/DigestAlgorithm.test.js @@ -204,16 +204,19 @@ export default function DigestAlgorithmJsunit() { } }) }) + expect(null).assertFail(); } catch (err) { expect(err.code).assertEqual(401); } try { await mdGenerator.update(0); + expect(null).assertFail(); } catch (err) { expect(err.code).assertEqual(401); } try { await mdGenerator.digest(); + expect(null).assertFail(); } catch (err) { console.error("err is " + err.code); expect(err.code).assertEqual(401) @@ -309,12 +312,14 @@ export default function DigestAlgorithmJsunit() { it("Security_crypto_framework_HMAC_0600", 0, async function (done) { try { cryptoFramework.createMac("SHA5"); + expect(null).assertFail(); } catch (err) { console.error("[Promise]: error code: " + err.code + ", message is: " + err.message); expect(err.code).assertEqual(801); } try { cryptoFramework.createMac(null); + expect(null).assertFail(); } catch (err) { console.error("[Promise]: error code: " + err.code + ", message is: " + err.message); expect(err.code).assertEqual(401); @@ -333,12 +338,14 @@ export default function DigestAlgorithmJsunit() { let key = globalsymKeyGenerator.generateKeyPair(); try { await globalHMAC.init(key); + expect(null).assertFail(); } catch (err) { console.error("[Promise]init(key): error code: " + err.code + ", message is: " + err.message); expect(err.code).assertEqual(401); }; try { await globalHMAC.init(null); + expect(null).assertFail(); } catch (err) { console.error("[Promise]init(null): error code: " + err.code + ", message is: " + err.message); expect(err.code).assertEqual(401); @@ -358,6 +365,7 @@ export default function DigestAlgorithmJsunit() { await globalHMAC.init(key); try { await globalHMAC.update(null); + expect(null).assertFail(); } catch (err) { console.error("[Promise]init(null): error code: " + err.code + ", message is: " + err.message); expect(err.code).assertEqual(401); diff --git a/security/cryptoFramework/js_api_test_one/src/main/js/test/SymmetricCryptography.test.js b/security/cryptoFramework/js_api_test_one/src/main/js/test/SymmetricCryptography.test.js index 74c57da6948f4e410fac7f12dbeebedd56000226..a277f1281d9aa7eb25bc245d1b447142fc33eaeb 100644 --- a/security/cryptoFramework/js_api_test_one/src/main/js/test/SymmetricCryptography.test.js +++ b/security/cryptoFramework/js_api_test_one/src/main/js/test/SymmetricCryptography.test.js @@ -647,13 +647,14 @@ export default function SymmetricCryptographyJsunit() { cryptoFramework.createCipher("3DES192|null|PKCS7"); expect(null).assertFail(); } catch (err) { - expect(err.code).assertEqual(801) + expect(err.code).assertEqual(801); + expect(null).assertFail(); } try { cryptoFramework.createCipher("3DES192|DDD|PKCS7"); expect(null).assertFail(); } catch (err) { - expect(err.code).assertEqual(801) + expect(err.code).assertEqual(801); } done(); } @@ -676,13 +677,13 @@ export default function SymmetricCryptographyJsunit() { cryptoFramework.createCipher("3DES192|ECB|null"); expect(null).assertFail(); } catch (err) { - expect(err.code).assertEqual(801) + expect(err.code).assertEqual(801); } try { cryptoFramework.createCipher("3DES192|ECB|CCCCC"); expect(null).assertFail(); } catch (err) { - expect(err.code).assertEqual(801) + expect(err.code).assertEqual(801); } done(); } @@ -735,6 +736,7 @@ export default function SymmetricCryptographyJsunit() { await cipherGenerator.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, publicModule.genCcmParamsSpec()); try { await cipherGenerator.update(null); + expect(null).assertFail(); } catch (err) { console.error("Security_crypto_framework_Symmetric_Encryption_AES_3000 catch error: " + err.code); expect(err.code).assertEqual(401);