|
function encrypt(data, key) { |
|
return CryptoJS.AES.encrypt(data, key).toString(); |
|
} |
|
|
|
function decrypt(data, key) { |
|
return CryptoJS.AES.decrypt(data, key).toString(CryptoJS.enc.Utf8); |
|
} |
->
http://cryptojs.altervista.org/secretkey/doc/doc_aes_cryptojs-v3.html
You're using unauthenticated AES-CBC. https://paragonie.com/blog/2015/05/using-encryption-and-authentication-correctly
Your About section says:
Since nobody can modify the code, and nobody can view the key unless you show it to them, nobody without the key can either read the plaintext or ship a malicious viewer which would exfiltrate the plaintext (or key).
...but this is strictly not true with unauthenticated encryption. In fact, you can recover the plaintext with a padding oracle attack.
Also, your RNG is biased.
|
function generate_key() { |
|
var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
|
|
|
var randombytes = new Uint8Array(32); |
|
crypto.getRandomValues(randombytes); |
|
|
|
var k = ''; |
|
for (var i = 0; i < 32; i++) { |
|
var idx = Math.floor(randombytes[i] * alphabet.length / 256); |
|
k += alphabet.charAt(idx); |
|
} |
|
return k; |
|
} |
hardbin/js/hardbin.js
Lines 5 to 11 in c77c2d7
You're using unauthenticated AES-CBC. https://paragonie.com/blog/2015/05/using-encryption-and-authentication-correctly
Your About section says:
...but this is strictly not true with unauthenticated encryption. In fact, you can recover the plaintext with a padding oracle attack.
Also, your RNG is biased.
hardbin/js/hardbin.js
Lines 13 to 25 in c77c2d7