Search code examples
gnupgpgporacle-fusion-middleware

Can an OpenPGP public key without UID exist?


Is below key valid?

The gpg --list-keys command lists the key information which has no label/email to it, I mean UID:

/home/XXXXXX/.gnupg/pubring.gpg
--------------------------------
pub   2048R/3BAAF156 2016-04-05
uid

Is it a valid key? Source said they are using Oracle Fusion Middleware pgp to generate the key.

How can I encrypt files using the key which has no UID?


Solution

  • RFC 4880, OpenPGP does not require keys to have a UID attached. Anyway, the output you posted seems more like the key has an empty UID (which is not forbidden when reading section 5.11. User ID Packet (Tag 13)). You can have GnuPG list all individual OpenPGP packets the key is constructed from by running gpg --export 3BAAF156 | gpg --list-packets.

    There are more ways to address a key than the UID -- actually, especially for scripting and development purposes specifying a fixed key ID or even better fingerprint is preferred. The short key ID that you can use is 3BAAF156 (instead of a mail address), but better use long key IDs instead.

    An example for the short key ID, encrypting the file example.txt:

    gpg --recipient 3BAAF156 --encrypt example.txt