Openssl req命令

摘要:
1、 简介req指令用于创建和处理PKCS#10格式的证书。2.语法opensslreq[-formPEM|DER][-outputPEM|DER][-infilename][-outputfilename][-text][-pubkey][-noout][-verify][-module][-nodes][-subject][-passinarg][-passoutarg][-keyfilenam

一、简介

req指令用来创建和处理PKCS#10格式的证书

二、语法

openssl  req [-inform PEM|DER] [-outform PEM|DER] [-in filename] [-out filename] [-text] [-pubkey] [-noout] [-verify] [-modulus] [-nodes] [-subject] [-passin arg] [-passout arg] [-key filename] [-keyform PEM|DER] [-keyout filename] [-rand file(s)] [-newkey rsa:bits] [-newkey dsa:file] [-newkey ec:file] [-digest] [-config filename] [-subj arg] [-multivalue-rdn] [-new] [-batch] [-x509] [-days n] [-set_serial n] [-newhdr][-asn1-kludge][ -no-asn1-kludge][-extensions section] [-reqexts section] [-utf8] [-nameopt option] [-reqopt option][-verbose] [engine id]

选项

 -inform arg    input format - DER or PEM
 -outform arg   output format - DER or PEM
 -in arg        input file
 -out arg       output file
 -text          text form of request
 -pubkey        output public key
 -noout         do not output REQ
 -verify        verify signature on REQ
 -modulus       RSA modulus
 -nodes         don't encrypt the output key
 -engine e      use engine e, possibly a hardware device
 -subject       output the request's subject
 -passin        private key password source
 -key file      use the private key contained in file
 -keyform arg   key file format
 -keyout arg    file to send the key to
 -rand file:file:...
                load the file (or the files in the directory) into
                the random number generator
 -newkey rsa:bits generate a new RSA key of 'bits' in size
 -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'
 -newkey ec:file generate a new EC key, parameters taken from CA in 'file'
 -[digest]      Digest to sign with (see openssl dgst -h for list)
 -config file   request template file.
 -subj arg      set or modify request subject
 -multivalue-rdn enable support for multivalued RDNs
 -new           new request.
 -batch         do not ask anything during request generation
 -x509          output a x509 structure instead of a cert. req.
 -days          number of days a certificate generated by -x509 is valid for.
 -set_serial    serial number to use for a certificate generated by -x509.
 -newhdr        output "NEW" in the header lines
 -asn1-kludge   Output the 'request' in a format that is wrong but some CA's
                have been reported as requiring
 -extensions .. specify certificate extension section (override value in config file)
 -reqexts ..    specify request extension section (override value in config file)
 -utf8          input characters are UTF8 (default ASCII)
 -nameopt arg    - various certificate name options
 -reqopt arg    - various request text options

三、实例

1、根据私钥生成证书请求

方式1

openssl genrsa -des -passout pass:"123456" -out prikey.pem 1024
openssl req -key prikey.pem -passin pass:"123456" -new -out cerreq.pem

方式2

交互式

openssl req -newkey rsa:1024 -keyout prikey.pem -passout pass:"123456" -new -out cerreq.pem

image

非交互式

openssl req -newkey rsa:1024 -keyout prikey.pem -passout pass:"123456" -config openssl.cnf -new -out cerreq.pem

image

2、用私钥验证请求签名

openssl req -verify -key client_prikey.pem -in client_req.csr -passin pass:"123456" -noout

image

3、生成一个自签名的根证书

openssl req -x509 -newkey rsa:1024 -keyout prikey.pem -passout pass:"123456" -config openssl.cnf -new -out certself.pem

image

4、生成带中文支持的请求(UTF-8)

openssl req -newkey rsa:1024 -keyout ca_prikey.key -passout pass:"123456" -new -x509 -utf8 -config openssl_utf8.cnf -out ca_self.pem

参考:http://blog.chinaunix.net/uid-7591044-id-1742939.html

5、生成带扩展项的请求

http://bbs.csdn.net/topics/380025010
参考:http://blog.csdn.net/as3luyuan123/article/details/16811787

免责声明:文章转载自《Openssl req命令》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇java事件Oracle中的Truncate和Delete语句下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

03点云文件常用格式转换(pcd,txt,ply,obj,stl)

1.pcd到txt1#include<iostream>2#include<fstream>3#include<pcl/io/pcd-io。h˃ 45intmain(intargc,char*argv[])6{78pcl::PointCloud<pcl:点XYZ>::Ptrcloud...

注册支付宝沙箱并测试支付宝扫码连接

2.创建新的支付宝应用程序2.1下载支付宝生成软件密钥#访问“支付宝开发平台”登录并访问开发者中心https://open.alipay.com/platform/home.htm#您可以参考“计算机网站支付”来熟悉计算机支付的整个流程https://docs.open.alipay.com/270/105899/2.1步骤1:创建应用程序(此处使用沙盒环境...

hiveserver2启动卡住问题解决方案

问题分析:hiveserver2可能是Hadoop集群进入安全模式,导致hiveserver2连接不上集群临时解决方案:离开安全模式即可#查看安全模式情况hdfsdfsadmin-safemodeget#离开安全模式hdfsdfsadmin-safemodeleave#进入安全模式hdfsdfsadmin-safemodeenter问题再分析:如何永久性的解...

scan chain的原理和实现——5.UDTP

UDTP(用户定义的测试点)指示DFTC在设计中用户指定的位置插入控制点和观察点。1.为什么使用UDTP?修复不可控的时钟和/或异步输入;增加设计的测试覆盖率;减少模式数量2.UDTP类型① 力0、力1、力01、力z0、力z1、力z01②控制_ 0...

安装gulp教程(整理)

所以安装nodejs。...

WinForm 中 comboBox控件之数据绑定

作为列表类型,public class Info{public string Id{get;Name=“Li Si”};infoList.Add(info3);...