OpenPGP key revocation in Java

OpenPGP key revocation is an action that marks an OpenPGP public key as not usable any more.

OpenPGP key revocation basics

OpenPGP key revocation must be performed in the cases when our private key is compromised or not needed any more. The revocation process internally consists of appending a special revocation signature to the public key that makes it impossible to be used any more.

Possible reasons for such action are when:

  • someone steals our private key and password
  • we have generated a new stronger key pair and the old one is not needed any more
  • the password for the private key has been lost (in this case only a designated revoker or a revocation certificate can revoke the key)

There are three ways to revoke a key described in the OpenPGP standard: directly, with a revocation certificate and through a designated revoker key.

When we revoke a key we have to specify a revocation reason code and an optional description note. Below are shown the possible revocation reason codes:

/** No reason specified */
/** Key is superseded */
/** Key has been compromised */
/** Key is no longer used */
/** User Id is no longer used */

Refer to the chapters below for detailed examples that demonstrate how to perform OpenPGP key revocation in Java:

Revoke a public key directly (direct key revocation),

Revoke a public key with a revocation certificate

Revoke a public key key through designated revoker