Package com.yubico.webauthn.data
Enum COSEAlgorithmIdentifier
- java.lang.Object
-
- java.lang.Enum<COSEAlgorithmIdentifier>
-
- com.yubico.webauthn.data.COSEAlgorithmIdentifier
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<COSEAlgorithmIdentifier>
public enum COSEAlgorithmIdentifier extends java.lang.Enum<COSEAlgorithmIdentifier>
A number identifying a cryptographic algorithm. The algorithm identifiers SHOULD be values registered in the IANA COSE Algorithms registry, for instance, -7 for "ES256" and -257 for "RS256".
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<COSEAlgorithmIdentifier>
fromId(long id)
Attempt to parse an integer as aCOSEAlgorithmIdentifier
.static java.util.Optional<COSEAlgorithmIdentifier>
fromPublicKey(@NonNull ByteArray publicKeyCose)
Read theCOSEAlgorithmIdentifier
from a public key in COSE_Key format.long
getId()
static COSEAlgorithmIdentifier
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static COSEAlgorithmIdentifier[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EdDSA
public static final COSEAlgorithmIdentifier EdDSA
-
ES256
public static final COSEAlgorithmIdentifier ES256
-
ES384
public static final COSEAlgorithmIdentifier ES384
-
ES512
public static final COSEAlgorithmIdentifier ES512
-
RS256
public static final COSEAlgorithmIdentifier RS256
-
RS384
public static final COSEAlgorithmIdentifier RS384
-
RS512
public static final COSEAlgorithmIdentifier RS512
-
RS1
public static final COSEAlgorithmIdentifier RS1
-
-
Method Detail
-
values
public static COSEAlgorithmIdentifier[] 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 (COSEAlgorithmIdentifier c : COSEAlgorithmIdentifier.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static COSEAlgorithmIdentifier valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
fromId
public static java.util.Optional<COSEAlgorithmIdentifier> fromId(long id)
Attempt to parse an integer as aCOSEAlgorithmIdentifier
.- Parameters:
id
- an integer equal to theid
of a constant inCOSEAlgorithmIdentifier
- Returns:
- The
COSEAlgorithmIdentifier
instance whoseid
equalsid
, if any. - See Also:
- §5.8.5. Cryptographic Algorithm Identifier (typedef COSEAlgorithmIdentifier)
-
fromPublicKey
public static java.util.Optional<COSEAlgorithmIdentifier> fromPublicKey(@NonNull @NonNull ByteArray publicKeyCose)
Read theCOSEAlgorithmIdentifier
from a public key in COSE_Key format.- Parameters:
publicKeyCose
- a public key in COSE_Key format.- Returns:
- The
alg
of thepublicKeyCose
parsed as aCOSEAlgorithmIdentifier
, if possible. Returns empty if theCOSEAlgorithmIdentifier
enum has no constant matching thealg
value. - Throws:
java.lang.IllegalArgumentException
- ifpublicKeyCose
is not a well-formed COSE_Key.
-
getId
public long getId()
-
-