ITeye博客

openssl genrsa

jdkleo · 2015-10-08 13:23 · linux · nginx · 操作系统 · Markdown

介绍

openssl genrsa 用于生成rsa私钥文件,生成是可以指定私钥长度和密码保护。

语法

openssl genrsa[-out filename] [-passout arg] [-des] [-des3] [-idea] [-f4] [-3] [-rand file(s)] [-engine id] [numbits]

一般使用

  1. E:\OpenSSL\foo>openssl genrsa -out rsa_pri.pme
  2. Loading 'screen' into random state - done
  3. Generating RSA private key, 512 bit long modulus
  4. .++++++++++++
  5. ...............++++++++++++
  6. e is 65537 (0x10001)

从输出可以看出,密钥长度是512bit。我们也可以指定密钥长度,密钥长度越长越安全,但使用密钥进行加解密时所耗费的时间也会变长。非对称密钥提高安全性的同时也带来了算法所耗费的大量时间,非对称密钥不对大块数据进行加密,应用领域是数字签名,密钥分发等小数据加密。

numbits   密钥长度(单位bit)

 

  1. openssl genrsa -out rsa_pri.pem 1024

 

 

-passout arg
对生成的rsa私钥文件施加密码保护,例如:使用idea算法对私钥文件进行密码保护。

 

  1. openssl genrsa  -idea -passout pass:123 -out rsa_pri.pem

 

-F4 / -3    指数(我不知道,算法里面的东西吧),默认是65537,例如上例中输出的最后一句话,e is 65537 (0x10001)

 

  1. E:\OpenSSL\foo>openssl genrsa  -3  -out rsa_pri.pem 2000
  2. Loading 'screen' into random state - done
  3. Generating RSA private key, 2000 bit long modulus
  4. ......................+++
  5. .............+++
  6. e is 3 (0x3)

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。