diff options
author | Ian C <ianc@noddybox.co.uk> | 2018-06-25 12:56:47 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2018-06-25 12:56:47 +0000 |
commit | db675a214185996b3334acf81ac5ea7e3e9ff43b (patch) | |
tree | 02bc84738845d78cda457df7849aa89ffad42085 /www/index.html | |
parent | 840c543df8fa62a0417e53c632751f03185f17a4 (diff) |
Added test page to try out AES encrpytion library.
Diffstat (limited to 'www/index.html')
-rw-r--r-- | www/index.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..09ab51c --- /dev/null +++ b/www/index.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html lang="en-GB"> +<head> +<meta charset="utf-8"> +<title>PassMan</title> +<link href="css/main.css" rel="stylesheet" id="stylelink"> +<script src="scripts/aes.js"></script> +</head> +<body> + +Source: <input type="text" id="source" value="Hello World"><br> +Passphrase: <input type="text" id="passphrase" value="Test"><br> +Result: <input type="text" id="result"><br> +Decrypted: <input type="text" id="decrypted"><br> +<input type="button" value="Encrypt" onclick="OnEncrypt()"> +<input type="button" value="Decrypt" onclick="OnDecrypt()"> +<input type="button" value="Clear" onclick="OnClear()"> + +<script> + +function OnEncrypt() +{ + var source = document.getElementById("source").value; + var phrase = document.getElementById("passphrase").value; + + var encryptedAES = CryptoJS.AES.encrypt(source, phrase); + + var str = encryptedAES.toString(); + + document.getElementById("result").value = str; +} + +function OnDecrypt() +{ + var source = document.getElementById("result").value; + var phrase = document.getElementById("passphrase").value; + + var decryptedBytes = CryptoJS.AES.decrypt(source, phrase); + + document.getElementById("decrypted").value = decryptedBytes.toString(CryptoJS.enc.Latin1); +} + +function OnClear() +{ + document.getElementById("decrypted").value = ""; +} + +</script> + +</body> +</html> + +<!-- vim: sw=4 ts=4 +--> |