public enum KeyUsage extends Enum<KeyUsage>
Enum Constant and Description |
---|
AGREE_KEY
Key is intended for deriving a key via a key agreement protocol such as Diffie-Hellman.
|
DECRYPT
Key is intended for decrypting data directly.
|
ENCRYPT
Key is intended for encrypting data directly.
|
SIGN
Key is intended for signing messages with digital signatures.
|
UNWRAP_KEY
Key is intended for decrypting (unwrapping) other keys.
|
VERIFY
Key is intended for verifying signatures on messages.
|
WRAP_KEY
Key is intended for encrypting (wrapping) other keys.
|
Modifier and Type | Method and Description |
---|---|
static EnumSet<KeyUsage> |
forKeyType(Class<? extends CryptoKey> keyType)
Returns the set of all key usages that are applicable to the given key type.
|
static Optional<KeyUsage> |
forWebCryptoName(String keyOperation)
Converts a Web Crypto/JWK key operation name into the equivalent key usage constant.
|
static EnumSet<KeyUsage> |
fromCertificate(Certificate certificate)
Determines what usages are allowed for a public key based on the associated certificate.
|
static EnumSet<KeyUsage> |
fromX509KeyUsageBits(boolean[] bits)
Converts an X.509 KeyUsage bit vector into a corresponding set of usage values.
|
Class<? extends CryptoKey> |
getKeyType()
The key type corresponding to this key usage.
|
String |
getWebCryptoName()
The standard WebCrypto KeyUsage name for this usage.
|
int |
getX509BitPosition()
The bit position of this usage in the X.509 KeyUsage extension.
|
String |
getX509StandardName()
The standard name of this key usage in the X.509 standard.
|
String |
toString() |
static boolean[] |
toX509KeyUsageBits(Set<KeyUsage> usages)
Converts a set of key usage values to an X.509 KeyUsage constraint bit string.
|
static KeyUsage |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static KeyUsage[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final KeyUsage ENCRYPT
public static final KeyUsage DECRYPT
public static final KeyUsage SIGN
public static final KeyUsage VERIFY
public static final KeyUsage AGREE_KEY
public static final KeyUsage WRAP_KEY
public static final KeyUsage UNWRAP_KEY
public static KeyUsage[] values()
for (KeyUsage c : KeyUsage.values()) System.out.println(c);
public static KeyUsage valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static EnumSet<KeyUsage> fromCertificate(Certificate certificate)
certificate
- the certificate to check for usage constraints.public static EnumSet<KeyUsage> fromX509KeyUsageBits(boolean[] bits)
bits
- the X.509 KeyUsage bit vector.public static EnumSet<KeyUsage> forKeyType(Class<? extends CryptoKey> keyType)
keyType
- the type of key.public static boolean[] toX509KeyUsageBits(Set<KeyUsage> usages)
usages
- the allowed usages.X509Certificate.getKeyUsage()
public static Optional<KeyUsage> forWebCryptoName(String keyOperation)
keyOperation
- a Web Crypto/JWK key operation name.public String getX509StandardName()
null
if no equivalent.public String getWebCryptoName()
public int getX509BitPosition()
public Class<? extends CryptoKey> getKeyType()
Copyright © 2010-2018, ForgeRock All Rights Reserved.