How to use the privateEncrypt function from crypto
Find comprehensive JavaScript crypto.privateEncrypt code examples handpicked from public code repositorys.
33 34 35 36 37 38 39 40 41 42
const kbits = bits / (1024); const privateKey = RSA_PrivatePem[keylen]; const publicKey = RSA_PublicPem[keylen]; for (let i = 0; i < n; i++) { const enc = crypto.privateEncrypt(privateKey, message); crypto.publicDecrypt(publicKey, enc); } bench.end(kbits);
0
3
2
GitHub: xofym/node-rsa
4 5 6 7 8 9 10 11 12 13
var jsEngine = require('./js.js')(keyPair, options); return { encrypt: function (buffer, usePrivate) { if (usePrivate) { return crypto.privateEncrypt({ key: options.rsaUtils.exportKey('private'), padding: constants.RSA_PKCS1_PADDING }, buffer); } else {
210
0
10
5 6 7 8 9 10 11 12 13 14 15 16
exports.privateDecrypt = crypto.privateDecrypt if (typeof crypto.privateEncrypt !== 'function') { exports.privateEncrypt = require('./browser').privateEncrypt } else { exports.privateEncrypt = crypto.privateEncrypt } if (typeof crypto.publicDecrypt !== 'function') { exports.publicDecrypt = require('./browser').publicDecrypt
0
0
0
+ 4 other calls in file
62 63 64 65 66 67 68 69 70
key: rsaKeyPemEncrypted, passphrase: 'password' }, encryptedBuffer); assert.strictEqual(decryptedBufferWithPassword.toString(), input); encryptedBuffer = crypto.privateEncrypt({ key: rsaKeyPemEncrypted, passphrase: bufferPassword }, bufferToEncrypt);
0
0
0
+ 29 other calls in file
GitHub: vzx7/secret
3 4 5 6 7 8 9 10 11 12 13 14
const fileContent = fs.readFileSync(`${process.env.TEXT_FILES_PATH}/data`, "utf8"); const privateKey = fs.readFileSync(`${process.env.DIR_KEYS}/priv_key`, "utf8"); // const encryptedString = crypto.privateEncrypt({ key: privateKey, passphrase: process.env.PASSPHRASE }, Buffer.from(fileContent)).toString("base64");
0
0
0
5 6 7 8 9 10 11 12 13 14 15 16
exports.privateDecrypt = crypto.privateDecrypt; if (typeof crypto.privateEncrypt !== 'function') { exports.privateEncrypt = require('./browser').privateEncrypt; } else { exports.privateEncrypt = crypto.privateEncrypt; } if (typeof crypto.publicDecrypt !== 'function') { exports.publicDecrypt = require('./browser').publicDecrypt;
0
0
0
+ 3 other calls in file
crypto.createHash is the most popular function in crypto (882 examples)