Lilia's Webcrypto branch rebased and a few very tiny tweaks

This commit is contained in:
lilia
2014-04-03 23:33:02 -07:00
committed by Matt Corallo
parent ab6ebbab16
commit 41d50d7480
7 changed files with 270 additions and 143 deletions

15
js/crypto.js Normal file
View File

@@ -0,0 +1,15 @@
function HmacSHA256(key, input) {
return window.crypto.subtle.sign({name: "HMAC", hash: "SHA-256"}, key, input);
}
function encryptAESCTR(input, key, counter) {
return window.crypto.subtle.encrypt({name: "AES-CTR", counter: counter}, key, input);
}
function decryptAESCTR(input, key, counter) {
return window.crypto.subtle.decrypt({name: "AES-CTR", counter: counter}, key, input);
}
function decryptAESCBC(input, key, iv) {
return window.crypto.subtle.decrypt({name: "AES-CBC", iv: iv}, key, input);
}