Package org.pgpainless.key.util
Enum RevocationAttributes.Reason
- java.lang.Object
-
- java.lang.Enum<RevocationAttributes.Reason>
-
- org.pgpainless.key.util.RevocationAttributes.Reason
-
- All Implemented Interfaces:
Serializable
,Comparable<RevocationAttributes.Reason>
- 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.
-
-
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
All Methods Static Methods Instance Methods Concrete Methods 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 theRevocationAttributes.Reason
the provided code encodes is a hard revocation reason, false otherwise.static boolean
isHardRevocation(RevocationAttributes.Reason reason)
Return true if the givenRevocationAttributes.Reason
is a hard revocation, false otherwise.String
toString()
static RevocationAttributes.Reason
valueOf(String name)
Returns the enum constant of this type with the specified name.static RevocationAttributes.Reason[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 Detail
-
values
public static RevocationAttributes.Reason[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RevocationAttributes.Reason c : RevocationAttributes.Reason.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RevocationAttributes.Reason valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- 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 theRevocationAttributes.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 givenRevocationAttributes.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
-
code
public byte code()
-
toString
public String toString()
- Overrides:
toString
in classEnum<RevocationAttributes.Reason>
-
-