mirror of
https://github.com/nodejs/node.git
synced 2025-04-30 23:56:58 +00:00

Fixes: https://github.com/nodejs/node/issues/38883 PR-URL: https://github.com/nodejs/node/pull/38914 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@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 crypto = require('crypto').webcrypto;
|
|
|
|
crypto.subtle.importKey(
|
|
'raw',
|
|
new Uint8Array(32),
|
|
{
|
|
name: 'AES-GCM'
|
|
},
|
|
false,
|
|
[ 'encrypt', 'decrypt' ])
|
|
.then((k) => {
|
|
assert.rejects(() => {
|
|
return crypto.subtle.decrypt({
|
|
name: 'AES-GCM',
|
|
iv: new Uint8Array(12),
|
|
}, k, new Uint8Array(0));
|
|
}, {
|
|
name: 'OperationError',
|
|
message: /The provided data is too small/,
|
|
});
|
|
});
|