javascript - using cryptojs to decrypt base64-encoded ciphertext with key / iv -
my ciphertext encrypted in aes-128-cbc mode pkcs1 padding. it's base64 encoded keys , ivs. i'm trying decrypt ciphertext cryptojs having difficulty. here's (non-working) code:
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script> <script> var plaintext = cryptojs.aes.decrypt( cryptojs.enc.base64.parse("..."), cryptojs.enc.base64.parse("..."), { iv: cryptojs.enc.base64.parse("...") } ); alert(plaintext.tostring(cryptojs.enc.latin).length); </script>
all .'s base64-encoded strings. documentation i'm gathering cryptojs uses cbc mode , pkcs7 padding default.
any ideas why it's not working?
edit: jsfiddle: http://jsfiddle.net/nsmxy/1/
Comments
Post a Comment