fix(node): re-add incorrectly removed crypto.privateEncrypt/Decrypt (#39187)

This commit is contained in:
Simon Schick 2019-10-22 13:52:28 -07:00 committed by Wesley Wigham
parent 9fc1486d6d
commit 74590ad311
2 changed files with 9 additions and 2 deletions

View File

@ -398,6 +398,8 @@ declare module "crypto" {
}
function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
function privateDecrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
function getCiphers(): string[];
function getCurves(): string[];
function getHashes(): string[];

View File

@ -648,9 +648,14 @@ import { promisify } from 'util';
}
{
const buf: Buffer = crypto.publicEncrypt({
const key = {
key: 'test',
oaepHash: 'sha1',
oaepLabel: Buffer.from('asd'),
}, Buffer.from([]));
};
const buf: Buffer = crypto.publicEncrypt(key, Buffer.from([]));
const dec: Buffer = crypto.publicDecrypt(key, buf);
const bufP: Buffer = crypto.privateEncrypt(key, Buffer.from([]));
const decp: Buffer = crypto.privateDecrypt(key, bufP);
}