This question have been ask several time in StackExchange's network but for my specific target I can't find a work around.
I have an encrypted private key using AES(Advance Encryption Standard). All data that I have are as follow:
- Password
- iv(Initialization Vector)
- v(I think it is version, I'm not sure)
- iter
- cipher:"aes"
- salt
- ct
For example I have follow ciphertext of message test
with password test
generated by Standford Javascript Crypto Library
{"iv":"d2zscEJjWILOCfbgR8vrIg==",
"v":1,
"iter":1000,
"ks":128,
"ts":64,
"mode":"ccm",
"adata":"",
"cipher":"aes",
"salt":"fD0VonCNcWQ=",
"ct":"s7giov0Y59RCPu33"}
But I can't decrypt my own encrypted private key by Standford Javascript Crypto Library, so I want to use OpenSSL. The problem with OpenSSL is I got "Bad magic number" Error, suppose I want to decrypt mentioned ciphertext to got test
message as follow:
openssl aes-128-cbc -d -iter 1000 -S 7C3D15A2708D7164 -iv 776CEC7042635882CE09F6E047CBEB22 -k test -in cipher.txt -out message.txt
But I got "Bad magic number" Error.
I have visited this answer but I can't solve this problem, It is possible I don't use commands correctly.I don't know how to correctly use |
(pipe) and echo
. My command is as follow:
echo s7giov0Y59RCPu33 | base64 -d | openssl aes-128-cbc -d -iter 1000 -S 7C3D15A2708D7164 -iv 776CEC7042635882CE09F6E047CBEB22 -k test -out message.txt -in