-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed as not planned
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.
Description
Version
v16.13.0
Platform
Linux relaybox 5.15.0-52-generic #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
crypto
What steps will reproduce the bug?
// Taken from https://www.rfc-editor.org/rfc/rfc5702.html#section-6.1
const modulus = 'wVwaxrHF2CK64aYKRUibLiH30KpPuPBjel7E8ZydQW1HYWHfoGmidzC2RnhwCC293hCzw+TFR2nqn8OVSY5t2Q==';
const exponent = 'AQAB';
createPublicKey({key: { n: modulus, e: exponent }, format: 'jwk'}); // Error thrown; see belowHow often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
PublicKeyObject instance is returned.
What do you see instead?
TypeError: The "key.key" property must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView, KeyObject, or CryptoKey. Received an instance of Object
at new NodeError (node:internal/errors:371:5)
at prepareAsymmetricKey (node:internal/crypto/keys:528:13)
at createPublicKey (node:internal/crypto/keys:589:5)
at Object.<anonymous> (/home/gus/repos/dnssec-verifier-js/src/lib/utils/crypto.spec.ts:53:25)
at Promise.then.completed (/home/gus/repos/dnssec-verifier-js/node_modules/jest-circus/build/utils.js:333:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/gus/repos/dnssec-verifier-js/node_modules/jest-circus/build/utils.js:259:10)
at _callCircusTest (/home/gus/repos/dnssec-verifier-js/node_modules/jest-circus/build/run.js:277:40)
at _runTest (/home/gus/repos/dnssec-verifier-js/node_modules/jest-circus/build/run.js:209:3)
at _runTestsForDescribeBlock (/home/gus/repos/dnssec-verifier-js/node_modules/jest-circus/build/run.js:97:9)
However, key must be an object since we're trying to import the key by specifying its exponent and modulus.
Additional information
No response
fredvollmer
Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.