openssl -k和-K的区别

使用openssl enc命令进行对称加密时,有-k(小写)和-K(大写)两个选项
openssl doc对-k的解释如下:

-k password
  the password to derive the key from. This is for compatibility with previous versions of OpenSSL. Superseded by the -pass argument.

openssl doc对-K的解释如下:

-K key
  the actual key to use: this must be represented as a string comprised only of hex digits. If only the key is specified, the IV must additionally specified using the -iv option. When both a key and a password are specified, the key given with the -K option will be used and the IV generated from the password will be taken. It probably does not make much sense to specify both key and password.

  • -K选项表示后面的输入即作为真正用于运算的密钥使用
  • -K选项表示后面的输入为口令,通过该口令派生出运算中所使用的密钥

你可能感兴趣的:(openssl -k和-K的区别)