Created
March 19, 2013 22:08
-
-
Save graste/5200590 to your computer and use it in GitHub Desktop.
CryptoJS AES Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>CryptoJS AES Test</title> | |
</head> | |
<body> | |
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/core-min.js"></script> | |
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script> | |
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js"></script> | |
<p>Create new encrypted files via:</p> | |
<code>openssl enc -aes-256-cbc -in SOURCE.FILE -out ENCRYPTED.AES -pass pass:"Secret Passphrase" -e -base64</code> | |
<script> | |
xhr = new XMLHttpRequest(); | |
xhr.overrideMimeType('text/plain'); | |
xhr.open("GET", "ENCRYPTED.AES", false); | |
xhr.send(null); | |
alert(CryptoJS.AES.decrypt(xhr.responseText.replace(/\n/, ''), prompt('passphrase', '')).toString(CryptoJS.enc.Utf8)); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Encryption:
openssl aes-256-cbc -in attack-plan.txt -out message.enc
Decryption:
openssl aes-256-cbc -d -in message.enc -out plain-text.txt