+6
-6
lines changedFilter options
+6
-6
lines changed Original file line number Diff line number Diff line change
@@ -448,22 +448,22 @@ for (const test of TEST_CASES) {
448
448
}
449
449
450
450
// Test that the authentication tag can be set at any point before calling
451
-
// final() in GCM or OCB mode.
451
+
// final() in GCM mode, OCB mode, and for ChaCha20-Poly1305.
452
452
{
453
453
const plain = Buffer.from('Hello world', 'utf8');
454
-
const key = Buffer.from('0123456789abcdef', 'utf8');
454
+
const key = Buffer.from('0123456789abcdefghijklmnopqrstuv', 'utf8');
455
455
const iv = Buffer.from('0123456789ab', 'utf8');
456
456
457
-
for (const mode of ['gcm', 'ocb']) {
458
-
for (const authTagLength of mode === 'gcm' ? [undefined, 8] : [8]) {
459
-
const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, {
457
+
for (const alg of ['aes-256-gcm', 'aes-256-ocb', 'chacha20-poly1305']) {
458
+
for (const authTagLength of alg === 'aes-256-gcm' ? [undefined, 8] : [8]) {
459
+
const cipher = crypto.createCipheriv(alg, key, iv, {
460
460
authTagLength
461
461
});
462
462
const ciphertext = Buffer.concat([cipher.update(plain), cipher.final()]);
463
463
const authTag = cipher.getAuthTag();
464
464
465
465
for (const authTagBeforeUpdate of [true, false]) {
466
-
const decipher = crypto.createDecipheriv(`aes-128-${mode}`, key, iv, {
466
+
const decipher = crypto.createDecipheriv(alg, key, iv, {
467
467
authTagLength
468
468
});
469
469
if (authTagBeforeUpdate) {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4