how to strip a subkey from a gpg key?

5

1

I am trying to remove the subkey from my OpenPGP key.

Here is the current state:

gpg> uid 1

pub  3072R/C08D1F4B  created: 2014-01-05  expires: never       usage: SCEA
                     trust: unknown       validity: unknown
sub  3072R/97AFAF8E  created: 2014-01-05  expires: never       usage: SEA
[ unknown] (1)* Vivarto (Banana) <vivarto@gmail.com>

So, there is a primary key, and a subkey:

pub  3072R/C08D1F4B  created: 2014-01-05  expires: never       usage: SCEA
sub  3072R/97AFAF8E  created: 2014-01-05  expires: never       usage: SEA

I'd like to have only the first part

pub  3072R/C08D1F4B  created: 2014-01-05  expires: never       usage: SCEA

I tried deluid, but got "You can't delete the last user ID!"

Vivarto

Posted 2014-11-15T18:35:51.823

Reputation: 165

I think my post is not sufficiently clear. What I need is to convert the current gpg key into the "old fashion" pgp key where encryption and signing were done by the same key. Maybe this explanation makes it clearer. – Vivarto – 2014-11-15T19:54:12.107

This is exactly by deleting the subkey. OpenPGP implementations will (by default) choose the newest key capable of the operation desired; if there is no subkey, the primary key will be used. The usage flag show what the key can be used for: S for signing, C for certifications, E for encryption and A for authentication. Your primary key is capable of doing everything, but the subkey will be used if available. – Jens Erat – 2014-11-15T20:27:30.343

Answers

6

You're trying to delete a user ID, not a subkey. Use key [n] and delkey instead. From the help comand inside gpg --edit-key:

uid         select user ID N
key         select subkey N
deluid      delete selected user IDs
delkey      delete selected subkeys

If you already shared your key with others, better revoke the key instead of deleting it. By deleting it, other's will not be able to realize you're not using it any more (you can't delete it on key servers and other's computers!), by revocation you're signalling "don't use this (sub)key any more".

Though, before deleting the subkey, read some words about key management ([1], [2], and I especially recommend Debian's notes on subkeys).

Jens Erat

Posted 2014-11-15T18:35:51.823

Reputation: 14 141

**is there any way to issue a single command to do all of this: **

  1. edit key
  2. keyname
  3. key
  4. delkey
  5. y(es)

Or is it necessary to do in through the interactive mode necessary? – Vivarto – 2014-11-16T08:39:50.623

I don't know of any other way but the interactive mode. – Jens Erat – 2014-11-16T08:52:56.940

Follow-up questions in comments with different topics/not aiming at clarification are discouraged in the stack exchange network. Better ask a new password (and also consider having a small peak at the manual/man pages of GnuPG). – Jens Erat – 2014-11-16T16:02:29.420