Message Boards Message Boards

Mimic GenerateSymmetricKey["password"] in openssl?

GROUPS:

What are the openssl command line parameters which would produce the same key as the GenerateSymmetricKey["password"] function? For example,

key = GenerateSymmetricKey["password", 
  Method -> <|  "InitializationVector" -> None, "Cipher" -> "AES256", "BlockMode" -> "CBC"|>] ;
key["Key"]

Produces the key "7wUOXiuJb4qDpJSmxq3QULZuLxcgUnWUwle4pLn53Kc=". How could I get openssl to produce the same key given the same password, either in Hex or base64 format?

POSTED BY: O Mirza
Answer
2 months ago

I believe the OpenSSL command line utility cannot directly generate that key from that password. The password parameter of GenerateSymmetricKey is passed to a key derivation function called scrypt. It looks like scrypt was recently added to OpenSSL, but in libcrypto, and it doesn't look like they have an way of calling it from the command line.

POSTED BY: Christopher Wolfram
Answer
1 month ago

Group Abstract Group Abstract