MCPcopy Index your code
hub / github.com/nodejs/node / testEncryptionWrongKey

Function testEncryptionWrongKey

test/parallel/test-webcrypto-encrypt-decrypt-rsa.js:134–152  ·  view source on GitHub ↗
({ algorithm,
                                        plaintext,
                                        hash,
                                        publicKeyBuffer,
                                        privateKeyBuffer })

Source from the content-addressed store, hash-verified

132}
133
134async function testEncryptionWrongKey({ algorithm,
135 plaintext,
136 hash,
137 publicKeyBuffer,
138 privateKeyBuffer }) {
139 const {
140 privateKey,
141 } = await importVectorKey(
142 publicKeyBuffer,
143 privateKeyBuffer,
144 algorithm.name,
145 hash,
146 ['encrypt'],
147 ['decrypt']);
148 return assert.rejects(
149 subtle.encrypt(algorithm, privateKey, plaintext), {
150 message: /Unable to use this key to encrypt/
151 });
152}
153
154async function testEncryptionBadUsage({ algorithm,
155 plaintext,

Calls 2

encryptMethod · 0.80
importVectorKeyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…