openssl 中 -nodes 参数的目的是什么?

发布于 2024-10-18 04:56:57 字数 47 浏览 5 评论 0原文

openssl 中的 -nodes 参数的用途是什么?

What is the purpose of the -nodes argument in openssl?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

滥情哥ㄟ 2024-10-25 04:56:57

选项-nodes不是英文单词“nodes”,而是“no DES”。当作为参数给出时,这意味着 OpenSSL 不会加密 PKCS#12 文件中的私钥。

要加密私钥,您可以省略 -nodes,您的密钥将使用 3DES-CBC 加密。为了加密密钥,OpenSSL 会提示您输入密码,并使用该密码通过密钥派生函数 EVP_BytesToKey

根据您的 OpenSSL 版本和编译选项,您也许能够提供这些选项来代替 -nodes

-des          encrypt private keys with DES
-des3         encrypt private keys with triple DES (default)
-idea         encrypt private keys with idea
-seed         encrypt private keys with seed
-aes128, -aes192, -aes256
              encrypt PEM output with cbc aes
-camellia128, -camellia192, -camellia256
              encrypt PEM output with cbc camellia

最终在库级别 OpenSSL 调用函数 PEM_write_bio_PrivateKey 以及您选择的加密算法(或缺少加密算法)。

The option -nodes is not the English word "nodes", but rather is "no DES". When given as an argument, it means OpenSSL will not encrypt the private key in a PKCS#12 file.

To encrypt the private key, you can omit -nodes and your key will be encrypted with 3DES-CBC. To encrypt the key, OpenSSL prompts you for a password and it uses that password to generate an encryption key using the key-derivation function EVP_BytesToKey.

Depending on your version of OpenSSL and compiled options, you may be able to provide these options in place of -nodes:

-des          encrypt private keys with DES
-des3         encrypt private keys with triple DES (default)
-idea         encrypt private keys with idea
-seed         encrypt private keys with seed
-aes128, -aes192, -aes256
              encrypt PEM output with cbc aes
-camellia128, -camellia192, -camellia256
              encrypt PEM output with cbc camellia

Ultimately at the library level OpenSSL calls the function PEM_write_bio_PrivateKey with the encryption algorithm (or lack thereof) you choose.

哎呦我呸! 2024-10-25 04:56:57

编辑: nginx v1.7.3 添加了 ssl_password_file 指令从指定文件中读取密码,并在上下文的 encrypted-private.key

indiv 上尝试每个密码,该 -nodes 参数正确意味着 OpenSSL 将创建未加密的private.key;否则,将会出现密码短语提示,要求您创建加密的私有密钥。请参阅 reqpkcs12, CA.pl

但是,我认为(对于程序员而言)目的是因为:

  • HTTP 服务器(例如 CA.pl)。 apache.org/docs/2.2/ssl/ssl_faq.html#removepassphrase" rel="noreferrer">Apache,Nginx) 无法在没有密码的情况下读取加密的私有密钥
    • 选项 A - 每次 HTTP 服务器启动时,必须提供加密专用密钥 的密码
    • 选项 B - 在 http { }server { } 上下文中指定 ssl_password_file file.keys;。 [参考]
    • 选项 C - 使用 -nodes 创建不加密的private.key

有用:锁定 private.key

  • { 将 HTTP 服务器添加到 ssl-cert > group }
  • sudo chown root:ssl-cert private.key - change 所有者private.keyroot用户,ssl-cert
  • sudo chmod 640 private.key - 更改private.key的访问权限 现在,对于所有者 R/W、组 R
  • ,HTTP 服务器应该能够启动并读取未加密的 private.key

选项 A

更强的安全性,但是当服务器重新启动时,必须<强>手动输入密码加密的私有密钥

选项B

中等安全性,并且可能在A/C

选项C 之间取得良好的平衡强>

安全性较弱,但不提示输入未加密的 private.key 密码

edit: nginx v1.7.3 has added an ssl_password_file directive which reads passphrases from a specified file trying each passphrase on the context's encrypted-private.key

indiv is correct that the -nodes argument means that OpenSSL will create UNencrypted private.key; otherwise, there will be a passphrase prompt to create encrypted-private.key. see req, pkcs12, CA.pl

however, I feel the purpose (for programmers) is because:

  • HTTP servers (e.g. Apache, Nginx) cannot read encrypted-private.key without passphrase →
    • Option A - each time HTTP server starts, must provide passphrase for encrypted-private.key
    • Option B - specify ssl_password_file file.keys; in http { } or server { } context. [ref]
    • Option C - use -nodes to create private.key without encryption

useful: lock down private.key

  • { add HTTP server to ssl-cert group }
  • sudo chown root:ssl-cert private.key - change owner of private.key to root user, ssl-cert group
  • sudo chmod 640 private.key - change access permissions of private.key to owner R/W, group R
  • now, HTTP server should be able to start and read UNencrypted private.key

Option A

stronger security, yet when server restarts, have to manually type in passphrase for encrypted-private.key

Option B

medium security, and probably good balance between A/C

Option C

weaker security, yet NOT prompted for UNencrypted private.key passphrase

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文