What happens with the crypto.createCipher(algorithm, password)

139 views
Skip to first unread message

Chris Casey

unread,
Oct 3, 2014, 9:37:51 AM10/3/14
to nod...@googlegroups.com
Trying to enable java guys to reproduce the results I get using crypto.createCipher(algorithm, password) for AES-256-CBC.
They have the same key (password) but cannot reproduce the same results.
They say they need an IV but this function does not use one (visibly).

Does this function (as opposed to the createCipheriv) use a null or generated iv that can be reproduced elsewhere?

Unfortunately the key being input into this is generated elsewhere and won't fit into the createCipheriv call.

Please excuse ignorance of questions but really not a cryptography guy, just trying to get this to work.
Been bashing my head on this for a few days.

Chris

Chris Casey

unread,
Oct 3, 2014, 10:06:20 AM10/3/14
to nod...@googlegroups.com
A follow up is why does createCipher accept a 32 char key and createCipheriv doesn't?

mscdex

unread,
Oct 3, 2014, 12:40:06 PM10/3/14
to nod...@googlegroups.com
On Friday, October 3, 2014 9:37:51 AM UTC-4, Chris Casey wrote:
Does this function (as opposed to the createCipheriv) use a null or generated iv that can be reproduced elsewhere?

`createCipher()` generates[1] a key and IV from the supplied password using `EVP_BytesToKey()`[2].

 

Unfortunately the key being input into this is generated elsewhere and won't fit into the createCipheriv call.


Perhaps you can create a small snippet of the relevant code in Java that you're trying to get to work in node and provide some example inputs and expected outputs.
 

[1] https://github.com/joyent/node/blob/6e689ece46726f39bdf93f1f35e01656f8fe27dc/src/node_crypto.cc#L2131
[2] https://www.openssl.org/docs/crypto/EVP_BytesToKey.html
Reply all
Reply to author
Forward
0 new messages