Package org.pgpainless.algorithm

# Enum Class KeyFlag

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

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

public enum KeyFlag extends Enum<KeyFlag>
Enumeration of different key flags. Key flags denote different capabilities of a key pair.

See Also:
  - RFC4880: Key Flags

## 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
`AUTHENTICATION`
This key may be used for authentication.
`CERTIFY_OTHER`
This key may be used to certify other keys.
`ENCRYPT_COMMS`
This key may be used to encrypt communications.
`ENCRYPT_STORAGE`
This key may be used to encrypt storage.
`SHARED`
The private component of this key may be in the possession of more than one person.
`SIGN_DATA`
This key may be used to sign data.
`SPLIT`
The private component of this key may have been split by a secret-sharing mechanism.

## Method Summary

Modifier and Type
Method
Description
`static boolean`
`containsAny(int mask, KeyFlag... flags)`
`static List<KeyFlag>`
`fromBitmask(int bitmask)`
Convert a bitmask into a list of `KeyFlags`.
`int`
`getFlag()`
Return the numeric id of the `KeyFlag`.
`static boolean`
`hasKeyFlag(int mask, KeyFlag flag)`
Return true if the provided bitmask has the bit for the provided flag set.
`static int`
`toBitmask(KeyFlag... flags)`
Encode a list of `KeyFlags` into a bitmask.
`static KeyFlag`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static KeyFlag[]`
`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

### CERTIFY_OTHER

public static final KeyFlag CERTIFY_OTHER
This key may be used to certify other keys.

### SIGN_DATA

public static final KeyFlag SIGN_DATA
This key may be used to sign data.

### ENCRYPT_COMMS

public static final KeyFlag ENCRYPT_COMMS
This key may be used to encrypt communications.

### ENCRYPT_STORAGE

public static final KeyFlag ENCRYPT_STORAGE
This key may be used to encrypt storage.

### SPLIT

public static final KeyFlag SPLIT
The private component of this key may have been split by a secret-sharing mechanism.

### AUTHENTICATION

public static final KeyFlag AUTHENTICATION
This key may be used for authentication.

### SHARED

public static final KeyFlag SHARED
The private component of this key may be in the possession of more than one person.

## Method Details

### values

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

### getFlag

public int getFlag()
Return the numeric id of the `KeyFlag`.

Returns:
  numeric id

### fromBitmask

public static List<KeyFlag> 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 int toBitmask(KeyFlag... flags)
Encode a list of `KeyFlags` into a bitmask.

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

### hasKeyFlag

public static boolean hasKeyFlag(int mask, KeyFlag flag)
Return true if the provided bitmask has the bit for the provided flag set. Return false if the mask does not contain the flag.

Parameters:
  `mask` - bitmask
  `flag` - flag to be tested for
Returns:
  true if flag is set, false otherwise

### containsAny

public static boolean containsAny(int mask, KeyFlag... flags)