summaryrefslogtreecommitdiff
path: root/lib/crypto.js
diff options
context:
space:
mode:
authorIngmar Runge <ingmar@irsoft.de>2013-11-19 22:38:15 +0100
committerFedor Indutny <fedor.indutny@gmail.com>2013-12-08 00:00:02 +0400
commite0d31ea2dbdc33dda0f295ceda07b7fc1de4e09c (patch)
treecf81c1a7d2e288f777507535aee375554762ad19 /lib/crypto.js
parentf9f9239fa2f1c33e17ed3b0e830099f64a70bd37 (diff)
downloadandroid-node-v8-e0d31ea2dbdc33dda0f295ceda07b7fc1de4e09c.tar.gz
android-node-v8-e0d31ea2dbdc33dda0f295ceda07b7fc1de4e09c.tar.bz2
android-node-v8-e0d31ea2dbdc33dda0f295ceda07b7fc1de4e09c.zip
crypto: support GCM authenticated encryption mode.
This adds two new member functions getAuthTag and setAuthTag that are useful for AES-GCM encryption modes. Use getAuthTag after Cipheriv.final, transmit the tag along with the data and use Decipheriv.setAuthTag to have the encrypted data verified.
Diffstat (limited to 'lib/crypto.js')
-rw-r--r--lib/crypto.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index db3ce1c431..add6a79d78 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -322,6 +322,15 @@ Cipheriv.prototype.update = Cipher.prototype.update;
Cipheriv.prototype.final = Cipher.prototype.final;
Cipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
+Cipheriv.prototype.getAuthTag = function() {
+ return this._binding.getAuthTag();
+};
+
+
+Cipheriv.prototype.setAuthTag = function(tagbuf) {
+ this._binding.setAuthTag(tagbuf);
+};
+
exports.createDecipher = exports.Decipher = Decipher;
@@ -367,6 +376,8 @@ Decipheriv.prototype.update = Cipher.prototype.update;
Decipheriv.prototype.final = Cipher.prototype.final;
Decipheriv.prototype.finaltol = Cipher.prototype.final;
Decipheriv.prototype.setAutoPadding = Cipher.prototype.setAutoPadding;
+Decipheriv.prototype.getAuthTag = Cipheriv.prototype.getAuthTag;
+Decipheriv.prototype.setAuthTag = Cipheriv.prototype.setAuthTag;