美文网首页
Linux_351_openssl创建私有证书

Linux_351_openssl创建私有证书

作者: 为宇绸缪 | 来源:发表于2023-01-02 21:47 被阅读0次

1、创建私钥和公钥,模拟证书颁发机构生成证书,生成一对密钥
1、指定私钥长度1024,并且将生成的私钥信息保存在文件里,且利用小括号功能,修改子shell的umask
(umask 077;openssl genrsa -out server1024.key 1024)
umask 077 更改系统当前的umask的值,创建文件后系统默认的权限
openssl genrsa -out server1024.key 1024 指定算法生成指定长度的密钥
() 括号表示开启一个子shell来创建当前的命令,不会修改当前全局的umask值,使用子shell临时生效

[root@web01 test_openssl]# (umask 077;openssl genrsa -out server1024.key 1024)
Generating RSA private key, 1024 bit long modulus
...............++++++
.....................................++++++
e is 65537 (0x10001)

2、读取私钥文件,选择非对称加密算法rsa,生成公钥,写入到文件中

openssl rsa -in server1024.key -pubout -out server1024.key.pub
让openssl指定rsa算法,读取server1024.key,-pubout 读取公钥信息,输出到server1-24.key.pub文件当中
[root@web01 test_openssl]# openssl rsa -in server1024.key -pubout -out server1024.key.pub
writing RSA key

3、生成证书
openssl req -new -x509 -key server1024.key -out server.crt -days 365
参数解释
req 创建整数
new 新证书
x509 证书标准格式
key 调用私钥文件
out 输出证书文件
days 证书有效期

[root@web01 test_openssl]# openssl req -new -x509 -key server1024.key -out server.crt -days 365
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) []:BJ  # 省份
Locality Name (eg, city) [Default City]:BJ  # 城市
Organization Name (eg, company) [Default Company Ltd]:luffycity  # 生成证书的组织
Organizational Unit Name (eg, section) []:IT  # 部门
# 填写服务器主机名,域名。客户端通过主机名和服务器连接,获取证书
Common Name (eg, your name or your server's hostname) []:luffycity.cn
Email Address []:601579538@qq.com  # 邮箱

[root@web01 test_openssl]# ls
server1024.key.pub  # 公钥文件
server1024.key      # 私钥文件
server.crt          # 证书

相关文章

  • Linux_351_openssl创建私有证书

    1、创建私钥和公钥,模拟证书颁发机构生成证书,生成一对密钥1、指定私钥长度1024,并且将生成的私钥信息保存在文件...

  • 创建私有CA签名证书

    1. 生成CA keystore keytool -keystore cakeystore.jks -alias ...

  • 创建CA

    创建CA和申请证书 创建私有CA: 首先在CA服务器端创建CA。 先去看openssl的配置文件: /etc/pk...

  • 创建私有CA和申请证书

    为什么要申请证书,因为发送数据的一方不确定建立连接的另一方是不是假冒的,这个时候就只能通过一个权威的第三方,验证确...

  • CA证书颁发以及SSH的用法

    1、创建私有CA并进行证书申请。 2、总结ssh常用参数、用法 SSH(全称 Secure Shell)是一种加密...

  • fastlane 管理证书

    没有安装fastlane则需要先执行 2.在git上创建一个私有仓库,用来存放证书. 3.创建好之后git clo...

  • 行云流水地实现用nginx配置本地IP为https

    nginx配置https私有证书访问 剧情需要,测试一下Java代码访问https,遂需要创建一个https的环境...

  • 组件化之pod 私有库

    一.创建私有Specs 1.创建私有Specs 比如如何删除私有仓库:pod repo remove [name]...

  • CocoaPods私有库制作

    创建私有Spec Repo 创建一个 Git仓库,这个仓库你可以创建私有的也可以创建公开的,不过既然私有的Spec...

  • cfssl

    下载 创建CA 创建证书请求 生成CA证书和私钥 创建kubernetes证书请求文件 kubernetes证书和...

网友评论

      本文标题:Linux_351_openssl创建私有证书

      本文链接:https://www.haomeiwen.com/subject/hxxhcdtx.html