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

Function testDecryptionWrongKey

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

Source from the content-addressed store, hash-verified

172}
173
174async function testDecryptionWrongKey({ ciphertext,
175 algorithm,
176 hash,
177 publicKeyBuffer,
178 privateKeyBuffer }) {
179 if (ciphertext === undefined)
180 return;
181
182 const {
183 publicKey
184 } = await importVectorKey(
185 publicKeyBuffer,
186 privateKeyBuffer,
187 algorithm.name,
188 hash,
189 ['encrypt'],
190 ['decrypt']);
191
192 return assert.rejects(
193 subtle.decrypt(algorithm, publicKey, ciphertext), {
194 message: /Unable to use this key to decrypt/
195 });
196}
197
198async function testDecryptionBadUsage({ ciphertext,
199 algorithm,

Calls 1

importVectorKeyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…