aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2019-01-03 18:59:34 +0100
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-01-07 07:33:35 +0100
commit7afdfaec083310baa66c05daf33409a7b55528dd (patch)
tree4d8b5ce10517efbc38356b2db244e726d7030cc5 /test
parent7ed790e9dbf7827056b2859a57e9ad72863c1d50 (diff)
downloadandroid-node-v8-7afdfaec083310baa66c05daf33409a7b55528dd.tar.gz
android-node-v8-7afdfaec083310baa66c05daf33409a7b55528dd.tar.bz2
android-node-v8-7afdfaec083310baa66c05daf33409a7b55528dd.zip
crypto: fix key object wrapping in sync keygen
PR-URL: https://github.com/nodejs/node/pull/25326 Fixes: https://github.com/nodejs/node/issues/25322 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-crypto-keygen.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js
index 43319c3859..aabd92e369 100644
--- a/test/parallel/test-crypto-keygen.js
+++ b/test/parallel/test-crypto-keygen.js
@@ -96,6 +96,21 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
}
{
+ // Test sync key generation with key objects.
+ const { publicKey, privateKey } = generateKeyPairSync('rsa', {
+ modulusLength: 512
+ });
+
+ assert.strictEqual(typeof publicKey, 'object');
+ assert.strictEqual(publicKey.type, 'public');
+ assert.strictEqual(publicKey.asymmetricKeyType, 'rsa');
+
+ assert.strictEqual(typeof privateKey, 'object');
+ assert.strictEqual(privateKey.type, 'private');
+ assert.strictEqual(privateKey.asymmetricKeyType, 'rsa');
+}
+
+{
const publicKeyEncoding = {
type: 'pkcs1',
format: 'der'