mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
make key size and authentication tag size explicit instead of trusting on defaults
This commit is contained in:
parent
5b7b234821
commit
a28aebae7d
|
@ -491,11 +491,13 @@ $(function() {
|
||||||
*/
|
*/
|
||||||
cipher: function(key, password, message)
|
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)
|
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);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user