https://www.gnupg.org/download/

mac
方式一:推荐
mac
$ brew install gpg pinentry pinentry-mac
$ echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
$ killall gpg-agent
如果使用期间发生错误,参考后面的 Inappropriate ioctl for device 配置环境变量。
SourceTree支持:
$ ls -la /usr/local/bin/gpg
lrwxr-xr-x /usr/local/bin/gpg -> ../Cellar/gnupg/2.2.10/bin/gpg
$ ln -s /usr/local/bin/gpg /usr/local/bin/gpg2
在SourceTree的配置界面,点“高级”,更改“GPG程序”路径为 /usr/local/bin。
方式二:
https://gpgtools.org/
下载dmg安装 pc
https://gpg4win.org/download.html linux (tarball)
$ mkdir ~/gnupg
$ cd ~/gnupg
$ wget https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.10.tar.bz2
wget https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.32.tar.bz2
wget https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.3.tar.bz2
wget https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2
wget https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.5.1.tar.bz2
wget https://www.gnupg.org/ftp/gcrypt/ntbtls/ntbtls-0.1.2.tar.bz2
wget https://www.gnupg.org/ftp/gcrypt/npth/npth-1.6.tar.bz2
wget https://www.gnupg.org/ftp/gcrypt/pinentry/pinentry-1.1.0.tar.bz2
// wget https://www.gnupg.org/ftp/gcrypt/gpgme/gpgme-1.11.1.tar.bz2
// wget https://www.gnupg.org/ftp/gcrypt/gpa/gpa-0.9.10.tar.bz2 $ tar xvjf gnupg-2.2.10.tar.bz2
tar xvjf libgpg-error-1.32.tar.bz2
tar xvjf libgcrypt-1.8.3.tar.bz2
tar xvjf libksba-1.3.5.tar.bz2
tar xvjf libassuan-2.5.1.tar.bz2
tar xvjf ntbtls-0.1.2.tar.bz2
tar xvjf npth-1.6.tar.bz2
tar xvjf pinentry-1.1.0.tar.bz2
// tar xvjf gpgme-1.11.1.tar.bz2
// tar xvjf gpa-0.9.10.tar.bz2 // 编译安装GnuPG组件
$ cd libgpg-error-1.32
$ ./configure
$ sudo make && sudo make install $ cd ../libgcrypt-1.8.3
$ ./configure
$ sudo make && sudo make install $ cd ../libksba-1.3.5
$ ./configure
$ sudo make && sudo make install $ cd ../libassuan-2.5.1
$ ./configure
$ sudo make && sudo make install $ cd ../ntbtls-0.1.2
$ ./configure
$ sudo make && sudo make install $ cd ../npth-1.6
$ ./configure
$ sudo make && sudo make install // 编译安装GnuPG
$ cd ../gnupg-2.2.10
$ ./configure
$ sudo make -j8 && sudo make install $ whereis gpg
gpg: /usr/bin/gpg /usr/local/bin/gpg /usr/share/man/man1/gpg.1.gz $ /usr/local/bin/gpg --version
/usr/local/bin/gpg: error while loading shared libraries: libgcrypt.so.20: cannot open shared object file: No such file or directory
正常会显示版本信息,如果出现这个错误,先获得libgcrypt.so.20文件的位置,然后加入变量LD_LIBRARY_PATH中:
$ whereis libgcrypt.so.20
libgcrypt.so: /usr/lib/libgcrypt.so.11 /usr/lib64/libgcrypt.so.11 /usr/local/lib/libgcrypt.so.20 /usr/local/lib/libgcrypt.so
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
$ /usr/local/bin/gpg --version
gpg (GnuPG) 2.2.10
libgcrypt 1.8.3
Copyright (C) 2018 Free Software Foundation, Inc.
...
将环境变量添加到启动配置,如.bashrc中
$ echo export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH >> ~/.bashrc 同理检查PATH环境变量,使/usr/local/bin在/usr/bin前,然gpg命令直接运行我们编译的版本。
重新进入会话,输入 gpg --version 应该是刚才安装的版本。 必要组件安装:
---
// 用于输入密码保护(必须)
$ cd ../pinentry-1.1.0
$ ./configure
$ sudo make && sudo make install ---
下面两个可选,可能需要修改库的路径,configure才能正确通过。
// GPGME is the standard library to access GnuPG functions from programming languages.
$ cd ../gpgme-1.11.1
$ ./configure
$ sudo make && sudo make install // GPA is a graphical frontend to GnuPG.
$ cd ../gpa-0.9.10
$ ./configure
$ sudo make && sudo make install
--- 最后可删除无用的源文件
$ cd ~
$ sudo rm -rf gnupg -----------------
使用
-----------------
1. 查看已有的GPG keys
$ gpg --list-secret-keys --keyid-format LONG 2. 创建一个GPG key
$ gpg --full-generate-key gpg (GnuPG) 2.2.10; 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. Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y GnuPG needs to construct a user ID to identify your key. Real name: yourname
Email address: yourname@email.com
Comment: demo
You selected this USER-ID:
"yourname (demo) <yourname@email.com>" Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
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.
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.
gpg: key F461FA2D923C3798 marked as ultimately trusted
gpg: revocation certificate stored as '/home/yourname/.gnupg/openpgp-revocs.d/BA4CF1650621335540E42DB5F461FA2D923C3798.rev'
public and secret key created and signed. pub rsa2048 2018-09-18 [SC]
BA4CF1650621335540E42DB5F461FA2D923C3798
uid yourname (demo) <yourname@email.com>
sub rsa2048 2018-09-18 [E] 3. 生成吊销证书
$ gpg --list-secret-keys --keyid-format LONG
/home/yourname/.gnupg/pubring.gpg
------------------------ sec rsa2048/F461FA2D923C3798 2018-09-18 [SC]
BA4CF1650621335540E42DB5F461FA2D923C3798
uid [ultimate] yourname (demo) <yourname@email.com>
ssb rsa2048/96E3D9B0C023B825 2018-09-18 [E] 记住sec中算法后面的值,输入在下面
(说明:也可以用邮箱地址替换这个KEY值) $ gpg --gen-revoke F461FA2D923C3798 4. 导出GPG key
$ gpg --armor --export F461FA2D923C3798 -----BEGIN PGP PUBLIC KEY BLOCK----- mQENBFugt1QBCACpIrObmogNUtVRGogRUub4GmP+4IlZxu+Q5ExhGHFNhdTOEbii
9OT4Vy6snZoURWwxKPNu5/W35cs57+tv/FjVEqp1fDgnhK8YHo1AtfO5Yjqq/UR/
mPBdOBsKlstKl9+cCR/dv+uE23/fJnNqfbLZUyv8GRPwBh7OggX2MO4elzzzujnH
...
-----END PGP PUBLIC KEY BLOCK----- 复制包括-----BEGIN PGP PUBLIC KEY BLOCK-----和-----END PGP PUBLIC KEY BLOCK-----的全部内容。 5. 添加一个user id到GPG key
$ gpg --edit-key F461FA2D923C3798
> adduid
Real name: myname
Email address: myname@email.com
Comment:
You selected this USER-ID:
"myname <myname@email.com>" Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o sec rsa2048/F461FA2D923C3798
created: 2018-09-18 expires: never usage: SC
trust: ultimate validity: ultimate
ssb rsa2048/96E3D9B0C023B825
created: 2018-09-18 expires: never usage: E
[ultimate] (1) yourname (demo) <yourname@email.com>
[ unknown] (2). myname <myname@email.com> > quit
Save changes? (y/N) y
可以使用help了解更多命令。 6. 应用
- 可在github设置 -> SSH and GPG keys里,添加生成PGP KEY,注意使用对应的邮箱和user id的GPG KEY
- 可用于git签名,如
$ git config --global user.signingkey F461FA2D923C3798 提交的签名
$ git config commit.gpgsign true
$ git config --global commit.gpgsign true
然后提交代码(-S):
$ git commit -S -m your commit message tag的签名(-s)
$ git tag -s mytag
验证(-v)
$ git tag -v mytag - 使用gpg-agent帮助减少密码输入,可将下面命令写入~/.xsession、 ~/.profile或者.bash_profile等启动文件
eval $(gpg-agent --daemon) -----------------
排除故障
-----------------
故障:Inappropriate ioctl for device
解决:
$ echo "test" | gpg --clearsign
如果提示 Inappropriate ioctl for device,设置变量指向tty
$ export GPG_TTY=$(tty)
$ echo 'export GPG_TTY=$(tty)' >> ~/.zshrc // 或者.bashrc, .bash_profile 故障:apt: Unknown error executing apt-key
解决:
sudo apt-get clean
sudo rm /var/lib/apt/lists/*
sudo rm /var/lib/apt/lists/partial/*
sudo apt-get clean
sudo apt-get update

tarball安装GnuPG (gpg) 2.2.10的更多相关文章

  1. VMware15安装MAC(MAC OS 10.13)(OS X 10.14)原版可升级最新可解锁macOS Unlocker3.0(OS X 10.13)

      目录树 1.1.2安装环境: 1.1.3所需资源: 1.1.4 Unlocker 3.0解锁 1.1.5 配置环境 1.1.6开始安装 1.1.7开启虚拟机进入MAC安装界面 1.1.8 macO ...

  2. 第一篇 HTML5打包APP之VMware15安装MAC(MAC OS 10.13)(OS X 10.14)原版可升级最新可解锁macOS Unlocker3.0(OS X 10.13)

    1.1.2安装环境: 1.1.3所需资源: 1.1.4 Unlocker 3.0解锁 1.1.5 配置环境 1.1.6开始安装 1.1.7开启虚拟机进入MAC安装界面 1.1.8 macOS 10.1 ...

  3. 史上!最最最简洁明了的 Java JDK 安装目录及其子目录含义 10分钟详解 - 精简归纳

    Java JDK 安装目录及其子目录含义 10分钟详解 - 精简归纳 JERRY_Z. ~ 2020 / 8 / 30 转载请注明出处!️ 目录 Java JDK 安装目录及其子目录含义 10分钟详解 ...

  4. 深入浅出 Java JDK 安装目录及其子目录含义 10分钟详解 - 精简归纳

    Java JDK 安装目录及其子目录含义 10分钟详解 - 精简归纳 JERRY_Z. ~ 2020 / 8 / 30 转载请注明出处!️ 目录 Java JDK 安装目录及其子目录含义 10分钟详解 ...

  5. yum安装时提示“尚未安装任何 GPG 公钥,请下载您希望安装的软件签名公钥并安装”

    在Linux操作系统中,安装软件依赖包时,出现了尚未安装任何 GPG 公钥,要求使用rpm --import public.gpg.key导入  问题: [root@server7 yum.repos ...

  6. 安装zabbix-3.0.3+nginx-1.10.1+php-5.6.22

    好久没有接触监控类的软件了,今天抽空搭建了下最新的版本 首先系统环境 zabbix-server-1 192.168.11.11   centos6.7 mysql-server    192.168 ...

  7. 给Windows + Apache 2.2 + PHP 5.3 安装PHP性能测试工具 xhprof_0.10.3_php53_vc9.dll

    1.下载XHProf 到这里 http://dev.freshsite.pl/php-extensions/xhprof.html 下载Windows版本的XHProf,我这里选择下载 XHProf ...

  8. Vmare12(虚拟机)安装Mac OS X Yosemite 10.10

    需要预备的软件如下: OSX10.10的系统镜像,下载好之后将后缀.cdr改成.iso,下载来源如下:    链接:http://pan.baidu.com/s/1sj4ri5R 密码:y86w un ...

  9. mac上虚拟机安装旧版本的macosx 10.8

    前言 由于测试的需要,需要10.8的macosx,但又不想降级自己mac版本,所以还是装虚拟机,Parallels Desktop试验了安装不了osx,就换VMware Fusion,发现是可以的. ...

随机推荐

  1. PAT 1121 Damn Single[简单]

    1121 Damn Single (25 分) "Damn Single (单身狗)" is the Chinese nickname for someone who is bei ...

  2. MySQL整理(三)

     一.简单单表操作   (1)简单CRUD 插入查询结果 insert into table1(id,name,age) select id,name,age from table2 where id ...

  3. (转)VS中的路径宏 vc++中OutDir、ProjectDir、SolutionDir各种路径说明

      $(RemoteMachine) 设置为“调试”属性页上“远程计算机”属性的值.有关更多信息,请参见更改用于 C/C++ 调试配置的项目设置. $(References) 以分号分隔的引用列表被添 ...

  4. k8s-离线安装coreos

    1.安装准备 下载iso 前往页面https://coreos.com/os/docs/latest/booting-with-iso.html 版本:stable 1465.7.0 日期:2017. ...

  5. 斐讯面试记录—阻塞Socket和非阻塞Socket

    文章出自:http://blog.csdn.net/VCSockets/ 1.TCP中的阻塞Socket和非阻塞Socket 阻塞与非阻塞是对一个文件描述符指定的文件或设备的两种工作方式. 阻塞的意思 ...

  6. javascript使用百度地图api和html5特性获取浏览器位置

    <!DOCTYPE html><html><head> <meta charset="utf-8"> <title>&l ...

  7. Linux_Vi_命令

    Linux Vi 命令 ************************************************************************* 在vi中使用命令的方法是:冒 ...

  8. 利用URLConnection来发送POST和GET请求

    URL的openConnection()方法将返回一个URLConnection对象,该对象表示应用程序和 URL 之间的通信链接.程序可以通过URLConnection实例向该URL发送请求.读取U ...

  9. C++基础---结构体(struct)

    转自:http://blog.csdn.net/cainv89/article/details/48447225 1. 结构体(struct) 1.1 结构体的概念 结构体(struct):是由一系列 ...

  10. 利用C++调用天气webservice-gSOAP方法

    首先需要下载一个gSOAP工具包 下载路径为:https://sourceforge.NET/projects/gsoap2/ 至于有关于gSOAP的一些用法和包含的文件的说明可从官网查看:http: ...