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

Function testEncryptionBadUsage

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

Source from the content-addressed store, hash-verified

152}
153
154async function testEncryptionBadUsage({ algorithm,
155 plaintext,
156 hash,
157 publicKeyBuffer,
158 privateKeyBuffer }) {
159 const {
160 publicKey,
161 } = await importVectorKey(
162 publicKeyBuffer,
163 privateKeyBuffer,
164 algorithm.name,
165 hash,
166 ['wrapKey'],
167 ['decrypt']);
168 return assert.rejects(
169 subtle.encrypt(algorithm, publicKey, plaintext), {
170 message: /Unable to use this key to encrypt/
171 });
172}
173
174async function testDecryptionWrongKey({ ciphertext,
175 algorithm,

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…