linux用openssl制作自签名数字证书

1.安装openssl

1.1查看是否安装了openssl

[root@hh ~]# rpm -ql openssl

1.2未安装,使用安装命令

yum install openssl

1.3安装完或已安装的会出现一下目录,可能会多一些目录

/etc/pki/CA
/etc/pki/CA/certs
/etc/pki/CA/crl
/etc/pki/CA/newcerts
/etc/pki/CA/private
/etc/pki/tls/certs/Makefile
/etc/pki/tls/certs/make-dummy-cert
/etc/pki/tls/certs/renew-dummy-cert
/etc/pki/tls/misc/CA
/etc/pki/tls/misc/c_hash
/etc/pki/tls/misc/c_info
/etc/pki/tls/misc/c_issuer
/etc/pki/tls/misc/c_name

2.创建自签名证书

2.1利用/etc/pki/tls/certs/Makefile中make命令生成证书,需先到该目录下才能使用make命令

cd /etc/pki/tls/certs/Makefile	
ls 
#效果:
[root@hh ~]# cd /etc/pki/tls/certs/
[root@hh certs]# ls
ca-bundle.crt  ca-bundle.trust.crt  make-dummy-cert  Makefile  renew-dummy-cert

2.2创建CA证书
开始会让你填密码,随意设个123456,然后是确定密码,接着让你填’.'继续,最后填上证书信息。
注意

  • 在填写时是只能填一遍,无法使用backspace键,只能输入信息,backspa也会当作信息输入。
  • 证书颁发给 / 颁发者姓名是在倒数第二项中填入,你填什么,最后显示什么,如我填入:ACCVRAIZI
    Common Name (eg, your name or your server's hostname) []:ACCVRAIZI
[root@hh certs]# make ../private/httpd.crt
umask 77 ; \
/usr/bin/openssl genrsa -aes128 2048 > ../private/httpd.key
Generating RSA private key, 2048 bit long modulus
......+++
...........+++
e is 65537 (0x10001)
Enter pass phrase:
Verifying - Enter pass phrase:
umask 77 ; \
/usr/bin/openssl req -utf8 -new -key ../private/httpd.key -x509 -days 365 -out ../private/httpd.crt 
Enter pass phrase for ../private/httpd.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]:.
State or Province Name (full name) []:CN
Locality Name (eg, city) [Default City]:Gongd^HDong
Organization Name (eg, company) [Default Company Ltd]:GuangZhou
Organizational Unit Name (eg, section) []:WUT
Common Name (eg, your name or your server's hostname) []:test.com
Email Address []:abc@qq.com

2.3最后用xftp连接你的linux虚拟机或云服务器,自签名证书存放在
/etc/pki/tls/private/路径下

[root@hh certs]# ls /etc/pki/tls/private/
httpd.crt  httpd.key

在这里插入图片描述

2.4证书:颁发者与颁发给为Common name项填写的名字

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值