🍄How To Never Use Gpg

GPG is not dead

There are some valid use cases of gpg and not all of them are easily replaceable. You probably don't need to replace it if you encrypt and/or sign your email messages. Or you are dealing with existing infrastructures like Linux package management or git commit signing. But there are three cases that can be replaced right now:

1. Encryption
2. Signing
3. Authentication

When they are used in isolation without existing infrastructure, they are easily replaceable with arguably better tools.

I'm not qualified enough to tell you why you should replace gpg but the general sentiment on the internet is that it is too big, too bloated and the general "web of trust" idea never succeeded. I don't know if any of that is true and maybe all of it is just hype.

How it used to be

When you follow the incredible setup of gpg for ssh authentication and do some jujutsu with --expert and feel like an expert, you get the following configuration with gpg -k greenfork.me:

pub   rsa4096 2021-09-01 [C]
      F3AF0138D877E3CA703CC421B045D59EB5CBF721
uid           [ultimate] Dmitry Matveyev <public@greenfork.me>
uid           [ultimate] Dmitry Matveyev <dev@greenfork.me>
sub   rsa4096 2021-09-01 [S] [expires: 2027-10-13]
sub   rsa4096 2021-09-01 [E] [expires: 2027-10-13]
sub   rsa4096 2021-09-01 [A] [expires: 2027-10-13]

There's a main key with [C], this is the master key that is used for creating all other keys. Normally you keep it backed up somewhere and you don't have it physically on your machine. You forget about it until the [A] gets expired in several years and you try to remember what the strange error means, and then you try to remember a way to renew the keys.

Then there are three keys:
1. [S] key for signing
2. [E] key for encryption
3. [A] key for authentication

These keys are present physically and used throughout your work.

With this set up you are as a proud user of gpg never have to worry about OpenSSH. OpenSSH is used in ssh, git and things like that.

How to reconstruct a private key for use in ssh

Once upon a time I needed to have a private ssh key because I needed it for an offline use. Usually I have my gpg key loaded into a gpg-agent that works on the background. But that doesn't work for scripts that are run without me sitting at the terminal. How do I reconstruct a private ssh key that I can use in ssh(1)? I couldn't find a way. Everything I tried didn't work for me or didn't exist.

It should still be possible, you can probably read a huge load of formats and there are good libraries that implement all of them. I didn't have time for that.

Time for a change

I switched to using alternative tools for all three purposes because of that.

1. Encryption with age.
2. Signing with minisign.
3. Authentication with OpenSSH.

Age and Minisign are simple tools with easy enough interfaces. They are becoming increasingly popular. Age has an alternative Rust implementation rage, a ton of tests and an open specification. Minisign is used for signing soupault, zig and uses (to my best knowledge) a very similar algorithm as signify developed by the OpenBSD project. OpenSSH is developed by the OpenBSD project.

For all of the reasons above I feel quite comfortable migrating to this tool set.