@@ -104,6 +104,16 @@ const privatePem = fixtures.readSync('test_rsa_privkey.pem', 'ascii'); |
|
|
104 |
104 |
assert.strictEqual(derivedPublicKey.asymmetricKeyType, 'rsa'); |
105 |
105 |
assert.strictEqual(derivedPublicKey.symmetricKeySize, undefined); |
106 |
106 |
|
|
107 |
+// Test exporting with an invalid options object, this should throw. |
|
108 |
+for (const opt of [undefined, null, 'foo', 0, NaN]) { |
|
109 |
+common.expectsError(() => publicKey.export(opt), { |
|
110 |
+type: TypeError, |
|
111 |
+code: 'ERR_INVALID_ARG_TYPE', |
|
112 |
+message: 'The "options" argument must be of type object. Received type ' + |
|
113 |
+typeof opt |
|
114 |
+}); |
|
115 |
+} |
|
116 |
+ |
107 |
117 |
const publicDER = publicKey.export({ |
108 |
118 |
format: 'der', |
109 |
119 |
type: 'pkcs1' |