summaryrefslogtreecommitdiff
path: root/test/parallel/test-crypto-dh.js
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2019-03-27 12:10:21 -0700
committerSam Roberts <vieuxtech@gmail.com>2019-03-28 14:03:18 -0700
commitbcbd35a48d00c915690682b546e6c282bd15150b (patch)
treea19f2dd6196b88399443762f63668f90c0c322c2 /test/parallel/test-crypto-dh.js
parent805e614ba7401a04330d8f2878d61213268d6e8b (diff)
downloadandroid-node-v8-bcbd35a48d00c915690682b546e6c282bd15150b.tar.gz
android-node-v8-bcbd35a48d00c915690682b546e6c282bd15150b.tar.bz2
android-node-v8-bcbd35a48d00c915690682b546e6c282bd15150b.zip
crypto: add openssl specific error properties
Don't force the user to parse the long-style OpenSSL error message, decorate the error with the library, reason, code, function. PR-URL: https://github.com/nodejs/node/pull/26868 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'test/parallel/test-crypto-dh.js')
-rw-r--r--test/parallel/test-crypto-dh.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js
index ead77d6a30..69d18f458e 100644
--- a/test/parallel/test-crypto-dh.js
+++ b/test/parallel/test-crypto-dh.js
@@ -91,8 +91,13 @@ const secret4 = dh4.computeSecret(key2, 'hex', 'base64');
assert.strictEqual(secret1, secret4);
-const wrongBlockLength =
- /^Error: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length$/;
+const wrongBlockLength = {
+ message: 'error:0606506D:digital envelope' +
+ ' routines:EVP_DecryptFinal_ex:wrong final block length',
+ code: 'ERR_OSSL_EVP_WRONG_FINAL_BLOCK_LENGTH',
+ library: 'digital envelope routines',
+ reason: 'wrong final block length'
+};
// Run this one twice to make sure that the dh3 clears its error properly
{
@@ -111,7 +116,7 @@ const wrongBlockLength =
assert.throws(() => {
dh3.computeSecret('');
-}, /^Error: Supplied key is too small$/);
+}, { message: 'Supplied key is too small' });
// Create a shared using a DH group.
const alice = crypto.createDiffieHellmanGroup('modp5');
@@ -260,7 +265,7 @@ if (availableCurves.has('prime256v1') && availableCurves.has('secp256k1')) {
assert.throws(() => {
ecdh4.setPublicKey(ecdh3.getPublicKey());
- }, /^Error: Failed to convert Buffer to EC_POINT$/);
+ }, { message: 'Failed to convert Buffer to EC_POINT' });
// Verify that we can use ECDH without having to use newly generated keys.
const ecdh5 = crypto.createECDH('secp256k1');