Package org.pgpainless.algorithm

# Enum Class Feature

java.lang.Object
java.lang.Enum<Feature>
org.pgpainless.algorithm.Feature

All Implemented Interfaces:
  `Serializable`, `Comparable<Feature>`, `Constable`

public enum Feature extends Enum<Feature>
An enumeration of features that may be set in the `Features` subpacket.

See Also:
  - RFC4880: Features

## 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
`GNUPG_AEAD_ENCRYPTED_DATA`
Support for Authenticated Encryption with Additional Data (AEAD).
`GNUPG_VERSION_5_PUBLIC_KEY`
If a key announces this feature, it is a version 5 public key.
`MODIFICATION_DETECTION`
Support for Symmetrically Encrypted Integrity Protected Data Packets (version 1) using Modification Detection Code Packets.
`MODIFICATION_DETECTION_2`
Support for Symmetrically Encrypted Integrity Protected Data packet version 2.

## Method Summary

Modifier and Type
Method
Description
`static List<Feature>`
`fromBitmask(int bitmask)`
Convert a bitmask into a list of `KeyFlags`.
`static Feature`
`fromId(byte id)`
Return the `Feature` encoded by the given id.
`byte`
`getFeatureId()`
Return the id of the feature.
`static Feature`
`requireFromId(byte id)`
Return the `Feature` encoded by the given id.
`static byte`
`toBitmask(Feature... features)`
Encode a list of `KeyFlags` into a bitmask.
`static Feature`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static Feature[]`
`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, toString, valueOf`

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

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

## Enum Constant Details

### MODIFICATION_DETECTION

public static final Feature MODIFICATION_DETECTION
Support for Symmetrically Encrypted Integrity Protected Data Packets (version 1) using Modification Detection Code Packets.

See Also:
  - RFC-4880 §5.14: Modification Detection Code Packet

### GNUPG_AEAD_ENCRYPTED_DATA

public static final Feature GNUPG_AEAD_ENCRYPTED_DATA
Support for Authenticated Encryption with Additional Data (AEAD). If a key announces this feature, it signals support for consuming AEAD Encrypted Data Packets. NOTE: PGPAINLESS DOES NOT YET SUPPORT THIS FEATURE!!! NOTE: This value is currently RESERVED.

See Also:
  - AEAD Encrypted Data Packet

### GNUPG_VERSION_5_PUBLIC_KEY

public static final Feature GNUPG_VERSION_5_PUBLIC_KEY
If a key announces this feature, it is a version 5 public key. The version 5 format is similar to the version 4 format except for the addition of a count for the key material. This count helps to parse secret key packets (which are an extension of the public key packet format) in the case of an unknown algorithm. In addition, fingerprints of version 5 keys are calculated differently from version 4 keys. NOTE: PGPAINLESS DOES NOT YET SUPPORT THIS FEATURE!!! NOTE: This value is currently RESERVED.

See Also:
  - Public-Key Packet Formats

### MODIFICATION_DETECTION_2

public static final Feature MODIFICATION_DETECTION_2
Support for Symmetrically Encrypted Integrity Protected Data packet version 2.

See Also:
  - crypto-refresh-06 §5.13.2. Version 2 Sym. Encrypted Integrity Protected Data Packet Format

## Method Details

### values

public static Feature[] 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 Feature 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

### fromId

@Nullable public static Feature fromId(byte id)
Return the `Feature` encoded by the given id. If the id does not match any known features, return null.

Parameters:
  `id` - feature id
Returns:
  feature

### requireFromId

@Nonnull public static Feature requireFromId(byte id)
Return the `Feature` encoded by the given id. If the id does not match any known features, throw an `NoSuchElementException`.

Parameters:
  `id` - feature id
Returns:
  feature
Throws:
  `NoSuchElementException` - if an unmatched feature id is encountered

### getFeatureId

public byte getFeatureId()
Return the id of the feature.

Returns:
  feature id

### fromBitmask

@Nonnull public static List<Feature> fromBitmask(int bitmask)
Convert a bitmask into a list of `KeyFlags`.

Parameters:
  `bitmask` - bitmask
Returns:
  list of key flags encoded by the bitmask

### toBitmask

public static byte toBitmask(Feature... features)
Encode a list of `KeyFlags` into a bitmask.

Parameters:
  `features` - list of flags
Returns:
  bitmask