gpg加密 与 openssl证书

1、在centos7中使用gpg创建RSA非对称密钥对


```powershell
[19:49:25 root@igcllq\ [ ~]#gpg --gen-key

gpg (GnuPG) 2.0.22; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

请选择您要使用的密钥种类:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (仅用于签名)
   (4) RSA (仅用于签名)
您的选择? 1
RSA 密钥长度应在 1024 位与 4096 位之间。
您想要用多大的密钥尺寸?(2048)1024
您所要求的密钥尺寸是 1024 位
请设定这把密钥的有效期限。
         0 = 密钥永不过期
      <n>  = 密钥在 n 天后过期
      <n>w = 密钥在 n 周后过期
      <n>m = 密钥在 n 月后过期
      <n>y = 密钥在 n 年后过期
密钥的有效期限是?(0) 0
密钥永远不会过期
以上正确吗?(y/n)y

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <[email protected]>"

真实姓名:centos7
电子邮件地址:
注释:

2、将CentOS7导出的公钥,拷贝到CentOS8中,在CentOS8中使用CentOS7的公钥加密一个文件
查看生成的公钥

查看centos7生成的公钥
[19:50:56 root@igcllq\ [ ~]#gpg --list-keys
/root/.gnupg/pubring.gpg

把centos7上的公钥到到centos7.pubkeyzhong,发送到centos8上

[20:01:04 root@igcllq\ [ ~]#gpg -a --export -o centos7.pubkey
[19:58:50 root@igcllq\ [ ~]#scp centos7.pubkey 10.0.0.8:/root
root@10.0.0.8's password: 
centos7.pubkey                                                       100% 1858     1.3MB/s   00:00    

centos8加密也需要密钥对

[root@CentOS8 ~]# gpg --gen-key
gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <[email protected]>"

真实姓名:centos8
电子邮件地址:
您选定了这个用户标识:
    “centos8”

Change (</
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值