Created
November 11, 2013 19:52
-
-
Save lholmquist/7419273 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
test( "Encrypt/Decrypt raw bytes providing password", function() { | |
var agCrypto = AeroGear.Crypto(), //Need to create a "Crypto" object to re-use | |
rawPassword = agCrypto.deriveKey( PASSWORD ), | |
utf8String = sjcl.codec.utf8String, | |
hex = sjcl.codec.hex, | |
cipherText, | |
options = { | |
AAD: hex.toBits( BOB_AAD ), | |
key: rawPassword, | |
data: utf8String.toBits( PLAIN_TEXT ) | |
}; | |
cipherText = agCrypto.encrypt( options ); | |
options.data = cipherText; | |
plainText = agCrypto.decrypt ( options ); | |
equal( utf8String.fromBits( plainText ), PLAIN_TEXT, "Encryption has failed" ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment