【问题标题】:Using SHA1 as a message digest when generating an aes256 cbc key生成 aes256 cbc 密钥时使用 SHA1 作为消息摘要
【发布时间】:2013-02-17 00:27:39
【问题描述】:

我必须为我的计算机安全课程做一个实验室,在那里我要使用 gpg 和 OpenSSL 进行安全通信。我对这一步感到困惑:

Use 'openssl enc' command line symmetric cipher routine to generate a 
256bit AES key in CBC mode. You should use SHA1 as a message digest 
function for generating the key. Save generated secret key, IV, and 
salt into file named aes.key. (Use –P opting to print out the key, 
salt and IV used then immediately exit, don’t do any encryption at 
this step.) 

但我正在浏览the man pages for openssl enc,但我看不到摘要的选项。我知道有一个 openssl dgst 命令,但它只是计算输入的哈希值。这个问题有缺陷吗? “您应该使用 SHA1 作为生成密钥的消息摘要函数”是什么意思?我是否生成一个密钥,然后只生成 SHA1(key.aes)?

对此的任何帮助将不胜感激。

谢谢。

【问题讨论】:

    标签: encryption openssl aes sha1


    【解决方案1】:

    来自openssl enc 的使用信息,当您给它一个未知参数(例如-h)时:

    -md            the next argument is the md to use to create a key
                     from a passphrase.  One of md2, md5, sha or sha1
    

    所以你应该使用-md sha1来指定SHA1作为使用的哈希函数 在密钥推导中。该步骤的完整解决方案是:

    openssl enc -aes-256-cbc -md sha1 -P
    

    他们实际上似乎忘记在manual page 中解释-md

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      相关资源
      最近更新 更多