Package org.pgpainless.key.util

# Enum Class RevocationAttributes.Reason

java.lang.Object
java.lang.Enum<RevocationAttributes.Reason>
org.pgpainless.key.util.RevocationAttributes.Reason

All Implemented Interfaces:
  `Serializable`, `Comparable<RevocationAttributes.Reason>`, `Constable`

Enclosing class:
  `RevocationAttributes`

public static enum RevocationAttributes.Reason extends Enum<RevocationAttributes.Reason>
Reason for revocation. There are two kinds of reasons: hard and soft reason. Soft revocation reasons gracefully disable keys or user-ids. Softly revoked keys can no longer be used to encrypt data to or to generate signatures. Any signature made after a key has been soft revoked is deemed invalid. Any signature made before the key has been soft revoked stays valid. Soft revoked info can be re-certified at a later point. Hard revocation reasons on the other hand renders the key or user-id invalid immediately. Hard reasons are suitable to use if for example a key got compromised. Any signature made before or after a key has been hard revoked is no longer considered valid. Hard revoked information can also not be re-certified.

## Nested Class Summary

## Nested classes/interfaces inherited from class java.lang.Enum

`Enum.EnumDesc<E extends Enum<E>>`

## Enum Constant Summary

Enum Constants
Enum Constant
Description
`KEY_COMPROMISED`
The key has potentially been compromised.
`KEY_RETIRED`
The key was retired and shall no longer be used.
`KEY_SUPERSEDED`
The key was superseded by another key.
`NO_REASON`
The key or certification is being revoked without a reason.
`USER_ID_NO_LONGER_VALID`
The user-id is no longer valid.

## Method Summary

Modifier and Type
Method
Description
`byte`
`code()`
`static RevocationAttributes.Reason`
`fromCode(byte code)`
Decode a machine-readable reason code.
`static boolean`
`isHardRevocation(byte code)`
Return true if the `RevocationAttributes.Reason` the provided code encodes is a hard revocation reason, false otherwise.
`static boolean`
`isHardRevocation(RevocationAttributes.Reason reason)`
Return true if the given `RevocationAttributes.Reason` is a hard revocation, false otherwise.
`static boolean`
`isKeyRevocation(byte code)`
Return true if the given reason code denotes a key revocation.
`static boolean`
`isKeyRevocation(RevocationAttributes.Reason reason)`
Return true if the given `RevocationAttributes.Reason` denotes a key revocation.
`String`
`toString()`
`static RevocationAttributes.Reason`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static RevocationAttributes.Reason[]`
`values()`
Returns an array containing the constants of this enum class, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Enum Constant Details

### NO_REASON

public static final RevocationAttributes.Reason NO_REASON
The key or certification is being revoked without a reason. This is a HARD revocation reason and cannot be undone.

### KEY_SUPERSEDED

public static final RevocationAttributes.Reason KEY_SUPERSEDED
The key was superseded by another key. This is a SOFT revocation reason and can be undone.

### KEY_COMPROMISED

public static final RevocationAttributes.Reason KEY_COMPROMISED
The key has potentially been compromised. This is a HARD revocation reason and cannot be undone.

### KEY_RETIRED

public static final RevocationAttributes.Reason KEY_RETIRED
The key was retired and shall no longer be used. This is a SOFT revocation reason can can be undone.

### USER_ID_NO_LONGER_VALID

public static final RevocationAttributes.Reason USER_ID_NO_LONGER_VALID
The user-id is no longer valid. This is a SOFT revocation reason and can be undone.

## Method Details

### values

public static RevocationAttributes.Reason[] values()
Returns an array containing the constants of this enum class, in the order they are declared.

Returns:
  an array containing the constants of this enum class, in the order they are declared

### valueOf

public static RevocationAttributes.Reason valueOf(String name)
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum class has no constant with the specified name
  `NullPointerException` - if the argument is null

### fromCode

public static RevocationAttributes.Reason fromCode(byte code)
Decode a machine-readable reason code.

Parameters:
  `code` - byte
Returns:
  reason

### isHardRevocation

public static boolean isHardRevocation(byte code)
Return true if the `RevocationAttributes.Reason` the provided code encodes is a hard revocation reason, false otherwise. Hard revocations cannot be undone, while keys or certifications with soft revocations can be re-certified by placing another signature on them.

Parameters:
  `code` - reason code
Returns:
  is hard

### isHardRevocation

public static boolean isHardRevocation(@Nonnull RevocationAttributes.Reason reason)
Return true if the given `RevocationAttributes.Reason` is a hard revocation, false otherwise. Hard revocations cannot be undone, while keys or certifications with soft revocations can be re-certified by placing another signature on them.

Parameters:
  `reason` - reason
Returns:
  is hard

### isKeyRevocation

public static boolean isKeyRevocation(@Nonnull RevocationAttributes.Reason reason)
Return true if the given `RevocationAttributes.Reason` denotes a key revocation.

Parameters:
  `reason` - reason
Returns:
  is key revocation

### isKeyRevocation

public static boolean isKeyRevocation(byte code)
Return true if the given reason code denotes a key revocation.

Parameters:
  `code` - reason code
Returns:
  is key revocation

### code

public byte code()

### toString

public String toString()

Overrides:
  `toString` in class `Enum<RevocationAttributes.Reason>`