版权声明:欢迎传播,请标明出处。 https://cloud.tencent.com/developer/article/1352504
网上找了下openssl 加解密 aes-128-cbc相关命令, 发现都比较含糊, 这里是摸索出的一个aes-12b-cbc加解密的实例.
echo "1234567890abc" > plain.txt
openssl enc -aes-128-cbc -in plain.txt -out encrypt.txt -iv f123 -K 1223 -p
salt=E0DEB1EAFE7F0000
key=12230000000000000000000000000000
iv =F1230000000000000000000000000000xxd plain.txt
00000000: 3132 3334 3536 3738 3930 6162 630a 1234567890abc.
xxd encrypt.txt
00000000: c5af 18cb ddee 9923 0374 6a21 9bb6 3f99 …#.tj!..?.openssl aes-128-cbc -d -in encrypt.txt -out encrypt_decrypt.txt -S E0DEB1EAFE7F0000 -iv F1230000000000000000000000000000 -K 12230000000000000000000000000000
-S salt Salt to use, specified as a hexidecimal string
-salt Use a salt in the key derivation routines (default)xxd encrypt_decrypt.txt
00000000: 3132 3334 3536 3738 3930 6162 630a 1234567890abc.