mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
8f742bb13f
PR-URL: https://github.com/nodejs/node/pull/50318 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
30 lines
583 B
JavaScript
30 lines
583 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const { subtle } = globalThis.crypto;
|
|
|
|
subtle.importKey(
|
|
'raw',
|
|
new Uint8Array(32),
|
|
{
|
|
name: 'AES-GCM'
|
|
},
|
|
false,
|
|
[ 'encrypt', 'decrypt' ])
|
|
.then((k) =>
|
|
assert.rejects(() => {
|
|
return subtle.decrypt({
|
|
name: 'AES-GCM',
|
|
iv: new Uint8Array(12),
|
|
}, k, new Uint8Array(0));
|
|
}, {
|
|
name: 'OperationError',
|
|
message: /The provided data is too small/,
|
|
})
|
|
).then(common.mustCall());
|