diff options
author | seishun <vvnicholas@gmail.com> | 2014-05-05 17:35:28 +0300 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-08-11 22:00:34 +0400 |
commit | 42bda05af8d628db90f3ee64fa2dd89973cb1e03 (patch) | |
tree | f322c4605779c7055e407221e3d1ab25f5dd1015 /lib/crypto.js | |
parent | 93f3b640d06df5e123e7ede90e40df06258d9d47 (diff) | |
download | nodejs-42bda05af8d628db90f3ee64fa2dd89973cb1e03.tar.gz nodejs-42bda05af8d628db90f3ee64fa2dd89973cb1e03.tar.bz2 nodejs-42bda05af8d628db90f3ee64fa2dd89973cb1e03.zip |
crypto: add RSA encryption
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'lib/crypto.js')
-rw-r--r-- | lib/crypto.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/crypto.js b/lib/crypto.js index c4256609b..16a3e38e2 100644 --- a/lib/crypto.js +++ b/lib/crypto.js @@ -355,6 +355,16 @@ Verify.prototype.verify = function(object, signature, sigEncoding) { return this._handle.verify(toBuf(object), toBuf(signature, sigEncoding)); }; +exports.publicEncrypt = function(object, buffer) { + return binding.publicEncrypt(toBuf(object), buffer); +}; + +exports.privateDecrypt = function(options, buffer) { + var key = options.key || options; + var passphrase = options.passphrase || null; + return binding.privateDecrypt(toBuf(key), buffer, passphrase); +}; + exports.createDiffieHellman = exports.DiffieHellman = DiffieHellman; |