GPG 可以用来签署和加密数据。方便发送和接收方进行数据加密和对方身份的确认。GPG 使用对称加密技术来加密大段内容,而采用非对称加密技术来交换对称加密的秘钥。

在Ubuntu下,用GPG命令可以实现文件的加密和解密,而且GPG基本上每个发行版都会预装。
gpg -c file # 加密一个文件,会生成file.gpg
gpg file.gpg # 解密file.gpg 还原成file文件
常用基本命令
gpg --gen-key # 生成秘钥对
gpg --list-keys # 查看已有的秘钥
gpg --delete-secret-keys <...> # 删除私钥
gpg --delete-key <...> # 删除公钥
gpg --armor --output public.key --export # 导出私钥
gpg --armor --output private.key --export-secret-keys # 导出公钥
gpg --keyserver hkp://keyserver.ubuntu.com:11371 --send-keys # 将公钥上传服务器
生成秘钥时候如果出现下面的提示后卡住
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.
手动安装一下面的软件即可解决问题!
sudo apt install rng-tools
下面是我在本地生成秘钥对并将公钥发到了服务器
公钥服务器:http://keys.gnupg.net/、http://keyserver.ubuntu.com:11371/
以上就是良许教程网为各位朋友分享的Linu系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二
维码进行关注,更多干货等着你 !
