zhangjiayin / crypto-js

Automatically exported from code.google.com/p/crypto-js
0 stars 0 forks source link

"Cannot read property '0' of undefined" #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an AES encryptor
2. run .process on data

What is the expected output? What do you see instead?
Expected output is ciphertext; instead, an exception is raised

What version of the product are you using? On what operating system?
Using CryptoJS 3.0.2 with Chrome 20 on OSX 10.7

Please provide any additional information below.
The following code raises the error deterministically for me:
(function(enc) { enc.process('some test data'); enc.process('test'); 
})(CryptoJS.algo.AES.createEncryptor('a test key'))

Reproduced the error on Safari (expectedly), and Firefox.

Original issue reported on code.google.com by TheU...@gmail.com on 13 Jul 2012 at 4:02

GoogleCodeExporter commented 8 years ago
The key that you pass to createEncryptor() must be the actual key -- that means 
a WordArray object of the size that the cipher expects. You'll also need to 
provide the IV.

Also, don't forget to capture the ciphertext return value of process(), 
otherwise you might lose some ciphertext.

Original comment by Jeff.Mott.OR on 13 Jul 2012 at 4:14

GoogleCodeExporter commented 8 years ago
ah ha, thank you!

Original comment by TheU...@gmail.com on 13 Jul 2012 at 4:15

GoogleCodeExporter commented 8 years ago

Original comment by Jeff.Mott.OR on 13 Jul 2012 at 5:02