`
cakin24
  • 浏览: 1368844 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

用OpenSSL命令行生成证书文件

阅读更多
一 生成服务器端的私钥server.key
 
[root@localhost opensscommand]# openssl genrsa -des3 -out server.key 1024
Generating RSA private key, 1024 bit long modulus
..................++++++
..................++++++
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:
二 生成服务器端证书请求server.csr
 
[root@localhost opensscommand]# openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:sanxi
Locality Name (eg, city) [Default City]:xian
Organization Name (eg, company) [Default Company Ltd]:Family Network
Organizational Unit Name (eg, section) []:Home
Common Name (eg, your name or your server's hostname) []:cakin24
Email Address []:cakin24@qq.com
 
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:123456
An optional company name []:
生成过程中需要输入以下信息:
Country Name: cn 两个字母的国家代号
State or Province Name: sanxi 省份名称
Locality Name: xian 城市名称
Organization Name: Family Network 公司名称
Organizational Unit Name: Home 部门名称
Common Name: cakin24 你的姓名
Email Address: cakin24@qq.com Email地址
 
三 生成客户端的的私钥client.key
[root@localhost opensscommand]# openssl genrsa -des3 -out client.key 1024
Generating RSA private key, 1024 bit long modulus
..................................................................................................++++++
.................++++++
e is 65537 (0x10001)
Enter pass phrase for client.key:
Verifying - Enter pass phrase for client.key:
 
四 生成客户端证书请求client.csr
 
[root@localhost opensscommand]# openssl req -new -key client.key -out client.csr
Enter pass phrase for client.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:sanxi
Locality Name (eg, city) [Default City]:xian
Organization Name (eg, company) [Default Company Ltd]:Family Network
Organizational Unit Name (eg, section) []:Home
Common Name (eg, your name or your server's hostname) []:cakin24
Email Address []:cakin24@qq.com
 
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:123456
An optional company name []:
 
五 生成自签名根证书ca.crt
 
[root@localhost opensscommand]# openssl req -new -x509 -keyout ca.key -out ca.crt
Generating a 2048 bit RSA private key
.................................+++
............+++
writing new private key to 'ca.key'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:sanxi
Locality Name (eg, city) [Default City]:xian
Organization Name (eg, company) [Default Company Ltd]:Family Network
Organizational Unit Name (eg, section) []:Home
Common Name (eg, your name or your server's hostname) []:cakin24
Email Address []:cakin24@qq.com 
 
六 用ca.crt给server.csr,client.csr文件签名
openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cnf
openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf
 
七 证书使用方法 
client使用的文件有:ca.crt,client.crt,client.key
server使用的文件有:ca.crt,server.crt,server.key
2
1
分享到:
评论

相关推荐

    做CA证书嫌OpenSSL命令行麻烦吗?来试试CABuilder4OpenSSL吧

    描述虽然为空,但从标题我们可以推测"CABuilder4OpenSSL"可能是一个图形化界面的应用程序,旨在帮助用户更轻松地执行OpenSSL命令行工具中的各种任务,比如创建自签名根证书、签发子证书、管理密钥对等。通过这样的...

    OpenSSL 解析P12格式证书文件

    在IT领域,OpenSSL 被广泛用于处理数字证书,包括解析、生成和管理各种类型的证书文件。P12格式,也称为PKCS#12,是一种常用的存储私钥和公钥证书的标准格式,常用于个人身份验证、服务器证书等场景。 在“OpenSSL ...

    java生成证书 包括openssl

    在本文中,我们将详细介绍如何使用 keytool 和 OpenSSL 生成证书。 生成证书的目的 在 HTTPS 环境下,证书是必不可少的组件。证书是由证书颁发机构(CA)颁发的数字文件,用于验证网站的身份和确保数据传输的安全...

    用openssl命令制作生成证书和自签名

    使用 OpenSSL 命令可以生成证书和自签名,以下是相关知识点的总结: 一、预安装准备 在开始使用 OpenSSL 之前,需要安装相关的软件和工具。首先,需要安装 Visual Studio 2005,因为 OpenSSL 的编译需要使用 VC++ ...

    openssl编译后生成文件

    - **可执行文件**:如果编译时包含了某些工具,如 `openssl` 命令行工具,那么也会生成相应的可执行文件,用于执行加密、解密、生成证书等操作。 使用编译后的头文件的优点在于,你可以快速地在项目中集成 OpenSSL...

    weblogic+OPENSSL+生成证书的SSL详细配置手册

    根据提供的文档信息,本文将详细解释如何通过OpenSSL生成安全证书并在WebLogic环境中...以上就是使用OpenSSL生成证书并在WebLogic中进行SSL配置的详细步骤。通过这些步骤,可以确保应用程序的数据传输安全性得到保障。

    使用openssl生成单向ssl证书

    本文将详细介绍如何使用openssl工具生成单向SSL证书,以及如何将其应用于基于Boost.Asio库的SSL通讯测试。 首先,让我们了解什么是单向SSL认证。在单向SSL认证中,服务器验证其身份给客户端,但客户端无需向服务器...

    openssl密钥生成工具

    **OpenSSL:强大的加密库与命令行工具** OpenSSL 是一个强大的安全套接层(SSL)和传输层安全(TLS)协议实现库,同时也包含了各种密码算法、常用的密钥和证书封装管理功能以及SSL协议,并提供丰富的应用程序供测试...

    证书生成工具OpenSSL1.0.2-2016年新版

    4. **命令行工具**:OpenSSL提供了一系列命令行工具,如`openssl genrsa`生成RSA私钥,`openssl req`创建证书请求,`openssl x509`处理证书等,方便进行证书管理和操作。 5. **库函数**:OpenSSL还提供了一组C语言...

    openssl密钥生成

    其中,`genpkey`用于生成私钥,`req`则用于生成证书请求,通常伴随着密钥对的生成。 3. **密钥生成步骤** - **生成私钥**: 使用`openssl genpkey`命令,例如: ``` openssl genpkey -algorithm RSA -out private...

    利用openssl自制CA证书

    在我们的场景中,我们将使用openssl来生成和管理数字证书。 创建CA证书的步骤如下: 1. **生成私钥**:首先,我们需要一个私钥来签署证书。在命令行中输入以下命令,生成一个名为`ca.key`的私钥: ``` openssl ...

    openssl windows版 带库和命令行工具

    - **生成密钥对**:可以使用 `openssl genpkey` 命令生成 RSA、DSA 或 EC 密钥对。 - **创建证书请求**:使用 `openssl req` 创建 X.509 证书请求,通常用于向证书颁发机构(CA)申请证书。 - **自签名证书**:通过 ...

    OpenSSL工具生成RSA密钥1

    在这个场景中,我们主要关注如何使用 OpenSSL 生成 RSA 密钥对,这是许多网络安全应用的基础,比如 SSL/TLS 加密、数字签名以及 SSH 连接等。 1. **安装 OpenSSL**: 在 Windows 上,你可以通过下载 OpenSSL 的 ...

    OpenSSL 最新编译后的文件

    3. **命令行工具**:如`openssl`命令,用于生成证书、密钥、CSR(证书签名请求)、进行加密解密操作和安全相关的测试。 在提供的“openssl-0.9.8i.rar”压缩包中,包含的文件可能有: - `openssl.exe`:命令行工具...

    openssl生成认证文件

    2. **创建CSR**: 基于私钥,使用`openssl req`生成证书签名请求。CSR包含了组织信息、地理位置等,这些信息将被包含在最终的证书中。 3. **签发证书**: 如果是自签名证书,可以直接用私钥签署CSR,使用`openssl x509...

    openssl 编译后文件

    这个文件夹包含编译后的可执行文件,如`openssl`命令行工具,它允许用户执行各种SSL/TLS相关的操作,如生成RSA密钥对、创建自签名证书、进行加密解密等。 2. **includes** 文件夹: 包含了OpenSSL库的所有头文件...

    OpenSSL1.1.1g安装包及生成证书批处理

    在这个场景中,我们讨论的是OpenSSL的1.1.1g版本的安装过程,以及如何在Windows环境下使用批处理脚本来生成不同类型的证书文件。 首先,`Win64OpenSSL-1_1_1g.exe` 是OpenSSL的64位Windows安装程序。安装这个软件将...

    用openssl为apache制作ssl证书

    生成好证书后,需要将证书文件`server.crt`和私钥文件`server.key`复制到Apache的相应目录下,通常这个目录位于`/etc/httpd/ssl/`或类似位置。然后配置Apache使其使用这些文件。具体配置方法因Apache版本和系统配置...

Global site tag (gtag.js) - Google Analytics