-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgpg.html
29 lines (29 loc) · 11.7 KB
/
gpg.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!doctype html><html lang=en-uk><head><script data-goatcounter=https://ruivieira-dev.goatcounter.com/count async src=//gc.zgo.at/count.js></script><script src=https://unpkg.com/@alpinejs/[email protected]/dist/cdn.min.js></script><script src=https://unpkg.com/[email protected]/dist/cdn.min.js></script><script type=module src=https://ruivieira.dev/js/deeplinks/deeplinks.js></script><link rel=preload href=https://ruivieira.dev/lib/fonts/fa-brands-400.woff2 as=font type=font/woff2 crossorigin=anonymous><link rel=preload href=https://ruivieira.dev/lib/fonts/fa-regular-400.woff2 as=font type=font/woff2 crossorigin=anonymous><link rel=preload href=https://ruivieira.dev/lib/fonts/fa-solid-900.woff2 as=font type=font/woff2 crossorigin=anonymous><link rel=preload href=https://ruivieira.dev/fonts/firacode/FiraCode-Regular.woff2 as=font type=font/woff2 crossorigin=anonymous><link rel=preload href=https://ruivieira.dev/fonts/vollkorn/Vollkorn-Regular.woff2 as=font type=font/woff2 crossorigin=anonymous><link rel=stylesheet href=https://ruivieira.dev/css/kbd.css type=text/css><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>GPG · Rui Vieira</title>
<link rel=canonical href=https://ruivieira.dev/gpg.html><meta name=viewport content="width=device-width,initial-scale=1"><meta name=robots content="all,follow"><meta name=googlebot content="index,follow,snippet,archive"><meta property="og:title" content="GPG"><meta property="og:description" content="InstallationmacOSYou can install GPG on macOS using:
$ brew install gpg WorkflowGetting existing keyTo get an existing key id use:
gpg --list-secret-keys --keyid-format LONG The key id will be available at
gpg --list-secret-keys --keyid-format LONG /home/foo/.gnupg/pubring.gpg ------------------------------ sec rsa2048/7FFFC09ACAC05FD0 2017-06-02 [SC] [expires: 2019-06-02] 5538B0F643277336BA7F0E457FFFC09ACAC05FD0 uid [ultimate] foo <foo@[example.com](http://realaddress.com)> ssb rsa2048/95E8A289DFE77A84 2017-06-02 [E] [expires: 2019-06-02] The key id we want, in this case is 7FFFC09ACAC05FD0.
To retrieve the public key use"><meta property="og:type" content="article"><meta property="og:url" content="https://ruivieira.dev/gpg.html"><meta property="article:section" content="posts"><meta property="article:modified_time" content="2023-09-02T17:28:34+01:00"><meta name=twitter:card content="summary"><meta name=twitter:title content="GPG"><meta name=twitter:description content="InstallationmacOSYou can install GPG on macOS using:
$ brew install gpg WorkflowGetting existing keyTo get an existing key id use:
gpg --list-secret-keys --keyid-format LONG The key id will be available at
gpg --list-secret-keys --keyid-format LONG /home/foo/.gnupg/pubring.gpg ------------------------------ sec rsa2048/7FFFC09ACAC05FD0 2017-06-02 [SC] [expires: 2019-06-02] 5538B0F643277336BA7F0E457FFFC09ACAC05FD0 uid [ultimate] foo <foo@[example.com](http://realaddress.com)> ssb rsa2048/95E8A289DFE77A84 2017-06-02 [E] [expires: 2019-06-02] The key id we want, in this case is 7FFFC09ACAC05FD0.
To retrieve the public key use"><link rel=stylesheet href=https://ruivieira.dev/css/styles.css><!--[if lt IE 9]><script src=https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js></script><script src=https://oss.maxcdn.com/respond/1.4.2/respond.min.js></script><![endif]--><link rel=icon type=image/png href=https://ruivieira.dev/images/favicon.ico></head><body class="max-width mx-auto px3 ltr" x-data="{currentHeading: undefined}"><div class="content index py4"><div id=header-post><a id=menu-icon href=#><i class="fas fa-eye fa-lg"></i></a>
<a id=menu-icon-tablet href=#><i class="fas fa-eye fa-lg"></i></a>
<a id=top-icon-tablet href=# onclick='$("html, body").animate({scrollTop:0},"fast")' style=display:none aria-label="Top of Page"><i class="fas fa-chevron-up fa-lg"></i></a>
<span id=menu><span id=nav><ul><li><a href=https://ruivieira.dev/>Home</a></li><li><a href=https://ruivieira.dev/blog/>Blog</a></li><li><a href=https://ruivieira.dev/draw/>Drawings</a></li><li><a href=https://ruivieira.dev/map/>All pages</a></li><li><a href=https://ruivieira.dev/search.html>Search</a></li></ul></span><br><div id=share style=display:none></div><div id=toc><h4>Contents</h4><nav id=TableOfContents><ul><li><a href=#installation :class="{'toc-h2':true, 'toc-highlight': currentHeading == '#installation' }">Installation</a></li><li><a href=#macos :class="{'toc-h3':true, 'toc-highlight': currentHeading == '#macos' }">macOS</a></li><li><a href=#workflow :class="{'toc-h2':true, 'toc-highlight': currentHeading == '#workflow' }">Workflow</a></li><li><a href=#getting-existing-key :class="{'toc-h3':true, 'toc-highlight': currentHeading == '#getting-existing-key' }">Getting existing key</a></li><li><a href=#troubleshooting :class="{'toc-h2':true, 'toc-highlight': currentHeading == '#troubleshooting' }">Troubleshooting</a></li><li><a href=#macos :class="{'toc-h3':true, 'toc-highlight': currentHeading == '#macos' }">macOS</a></li><li><a href=#cant-access-keychain-from-ui :class="{'toc-h4':true, 'toc-highlight': currentHeading == '#cant-access-keychain-from-ui' }">Can’t access keychain from UI</a></li></ul></nav></ul></nav></div></span></div><article class=post itemscope itemtype=http://schema.org/BlogPosting><header><h1 class=posttitle itemprop="name headline">GPG</h1><div class=meta><div class=postdate>Updated <time datetime="2023-09-02 17:28:34 +0100 BST" itemprop=datePublished>2023-09-02</time>
<span class=commit-hash>(<a href=https://ruivieira.dev/log/index.html#d64c4a5>d64c4a5</a>)</span></div></div></header><div class=content itemprop=articleBody><h2 id=installation x-intersect="currentHeading = '#installation'">Installation</h2><h3 id=macos x-intersect="currentHeading = '#macos'">macOS</h3><p>You can install GPG on macOS using:</p><div class=highlight><pre tabindex=0 style=background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>$ brew install gpg
</span></span></code></pre></div><h2 id=workflow x-intersect="currentHeading = '#workflow'">Workflow</h2><h3 id=getting-existing-key x-intersect="currentHeading = '#getting-existing-key'">Getting existing key</h3><p>To get an <em>existing</em> key id use:</p><div class=highlight><pre tabindex=0 style=background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>gpg --list-secret-keys --keyid-format LONG
</span></span></code></pre></div><p>The key id will be available at</p><div class=highlight><pre tabindex=0 style=background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>gpg --list-secret-keys --keyid-format LONG /home/foo/.gnupg/pubring.gpg
</span></span><span style=display:flex><span>------------------------------
</span></span><span style=display:flex><span>sec rsa2048/7FFFC09ACAC05FD0 2017-06-02 <span style=font-weight:700>[</span>SC<span style=font-weight:700>]</span> <span style=font-weight:700>[</span>expires: 2019-06-02<span style=font-weight:700>]</span> 5538B0F643277336BA7F0E457FFFC09ACAC05FD0 uid <span style=font-weight:700>[</span>ultimate<span style=font-weight:700>]</span> foo <foo@<span style=font-weight:700>[</span>example.com<span style=font-weight:700>](</span>http://realaddress.com<span style=font-weight:700>)</span>> ssb rsa2048/95E8A289DFE77A84 2017-06-02 <span style=font-weight:700>[</span>E<span style=font-weight:700>]</span> <span style=font-weight:700>[</span>expires: 2019-06-02<span style=font-weight:700>]</span>
</span></span></code></pre></div><p>The key id we want, in this case is <code>7FFFC09ACAC05FD0</code>.</p><p>To retrieve the public key use</p><div class=highlight><pre tabindex=0 style=background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>gpg --armor --export 7FFFC09ACAC05FD0
</span></span></code></pre></div><p>And the result will be</p><div class=highlight><pre tabindex=0 style=background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>-----BEGIN PGP PUBLIC KEY BLOCK-----
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>... The actual key ...
</span></span><span style=display:flex><span>-----END PGP PUBLIC KEY BLOCK-----
</span></span></code></pre></div><h2 id=troubleshooting x-intersect="currentHeading = '#troubleshooting'">Troubleshooting</h2><h3 id=macos-1 x-intersect="currentHeading = '#macos-1'">macOS</h3><h4 id=cant-access-keychain-from-ui x-intersect="currentHeading = '#cant-access-keychain-from-ui'">Can’t access keychain from UI</h4><p>If a program cannot access the keychain from the UI, probably there’s some problem in prompting you for the passphrase. You can install, for instance <code>pinentry</code> to solve this. Install it with</p><div class=highlight><pre tabindex=0 style=background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>$ brew install pinentry-mac
</span></span></code></pre></div><p>and then register <code>pinentry</code> as the passphrase input option:</p><div class=highlight><pre tabindex=0 style=background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>$ <span style=color:#999>echo</span> <span style=color:#b84>"pinentry-program /usr/local/bin/pinentry-mac"</span> >> ~/.gnupg/gpg-agent.conf
</span></span></code></pre></div></div></article><div id=footer-post-container><div id=footer-post><div id=nav-footer style=display:none><ul><li><a href=https://ruivieira.dev/>Home</a></li><li><a href=https://ruivieira.dev/blog/>Blog</a></li><li><a href=https://ruivieira.dev/draw/>Drawings</a></li><li><a href=https://ruivieira.dev/map/>All pages</a></li><li><a href=https://ruivieira.dev/search.html>Search</a></li></ul></div><div id=toc-footer style=display:none><nav id=TableOfContents><ul><li><a href=#installation>Installation</a><ul><li><a href=#macos>macOS</a></li></ul></li><li><a href=#workflow>Workflow</a><ul><li><a href=#getting-existing-key>Getting existing key</a></li></ul></li><li><a href=#troubleshooting>Troubleshooting</a><ul><li><a href=#macos-1>macOS</a></li></ul></li></ul></nav></div><div id=share-footer style=display:none></div><div id=actions-footer><a id=menu-toggle class=icon href=# onclick='return $("#nav-footer").toggle(),!1' aria-label=Menu><i class="fas fa-bars fa-lg" aria-hidden=true></i> Menu</a>
<a id=toc-toggle class=icon href=# onclick='return $("#toc-footer").toggle(),!1' aria-label=TOC><i class="fas fa-list fa-lg" aria-hidden=true></i> TOC</a>
<a id=share-toggle class=icon href=# onclick='return $("#share-footer").toggle(),!1' aria-label=Share><i class="fas fa-share-alt fa-lg" aria-hidden=true></i> share</a>
<a id=top style=display:none class=icon href=# onclick='$("html, body").animate({scrollTop:0},"fast")' aria-label="Top of Page"><i class="fas fa-chevron-up fa-lg" aria-hidden=true></i> Top</a></div></div></div><footer id=footer><div class=footer-left>Copyright © 2024 Rui Vieira</div><div class=footer-right><nav><ul><li><a href=https://ruivieira.dev/>Home</a></li><li><a href=https://ruivieira.dev/blog/>Blog</a></li><li><a href=https://ruivieira.dev/draw/>Drawings</a></li><li><a href=https://ruivieira.dev/map/>All pages</a></li><li><a href=https://ruivieira.dev/search.html>Search</a></li></ul></nav></div></footer></div></body><link rel=stylesheet href=https://ruivieira.dev/css/fa.min.css><script src=https://ruivieira.dev/js/jquery-3.6.0.min.js></script><script src=https://ruivieira.dev/js/mark.min.js></script><script src=https://ruivieira.dev/js/main.js></script></html>