标签:yellowconvict 私钥 入门 -- gpg 秘钥 使用 output
1. 生成秘钥
gpg --full-generate-key
等价于 gpg --full-gen-key
Real name: yellowconvict
为该秘钥的名字,也称为 USER-ID
在生成秘钥前最后一步还需要为秘钥设置密码
2. 查看公私钥
2.1 查看公钥
gpg --list-key
2.2 查看私钥
gpg --list-secret-key
3. 导出公私钥
--armor
: 将其转换为ASCII码显示
3.1 导出公钥
gpg --armor --output 文件名 --export 用户ID
如:
gpg --armor --output yellowconvict.pub --export yellowconvict
3.2 导出私钥
gpg --armor --output 输出文件 --export-secret-keys 用户ID
gpg --armor --output yellowconvict.pri --export-secret-keys yellowconvict
导出私钥时需要输入一开始为秘钥设置的密码
4. 使用公钥加密文件
gpg --recipient 用户ID --output 输出文件 --encrypt 原始文件
5. 使用私钥解密文件
gpg --output 输出文件 --decrypt 已加密文件
第一次使用私钥解密需要输入为秘钥设置的密码,之后就不需要输入了
6. 删除秘钥
必须先删除私钥,才能删除公钥
6.1 删除私钥
gpg --delete-secret-keys yellowconvict
6.2 删除公钥
gpg --delete-keys yellowconvict
7. 其他
第一次生成秘钥时,可能出现卡住的问题,类似如下提示:
Not enough random bytes available. Please do some other work to give the OS a chance to collect more
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
解决方法:
不要退出当前终端,新建一个终端,并根据系统执行以下命令,命令执行完后,卡住的界面瞬间完成
Ubuntu:
$ sudo apt install rng-tools
$ rng -r /dev/urandom
CentOS:
$ yum install rng-tools
$ rngd -r /dev/urandom
标签:yellowconvict,私钥,入门,--,gpg,秘钥,使用,output 来源: https://www.cnblogs.com/convict/p/15845933.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。