summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorseishun <vvnicholas@gmail.com>2014-05-05 17:35:28 +0300
committerFedor Indutny <fedor@indutny.com>2014-08-11 22:00:34 +0400
commit42bda05af8d628db90f3ee64fa2dd89973cb1e03 (patch)
treef322c4605779c7055e407221e3d1ab25f5dd1015 /lib
parent93f3b640d06df5e123e7ede90e40df06258d9d47 (diff)
downloadnodejs-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')
-rw-r--r--lib/crypto.js10
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;