From a28aebae7d1804d324c8073080d7d698875e200f Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 9 Aug 2016 13:16:15 +0200 Subject: [PATCH] make key size and authentication tag size explicit instead of trusting on defaults --- js/privatebin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index a56b946..5b85138 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -491,11 +491,13 @@ $(function() { */ cipher: function(key, password, message) { + // Galois Counter Mode, keysize 256 bit, authentication tag 128 bit + var options = {mode: 'gcm', ks: 256, ts: 128}; if ((password || '').trim().length === 0) { - return sjcl.encrypt(key, this.compress(message), {mode : 'gcm'}); + return sjcl.encrypt(key, this.compress(message), options); } - return sjcl.encrypt(key + sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(password)), this.compress(message), {mode : 'gcm'}); + return sjcl.encrypt(key + sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(password)), this.compress(message), options); }, /**