Class KeyDefinitions
- Namespace
- Yubico.YubiKey.Cryptography
- Assembly
- Yubico.YubiKey.dll
Provides definitions for cryptographic keys, including their types, lengths, and other properties.
public static class KeyDefinitions
- Inheritance
-
objectKeyDefinitions
Fields
AES128
Represents an AES key with a length of 128 bits.
public static readonly KeyDefinition AES128
Field Value
AES192
Represents an AES key with a length of 192 bits.
public static readonly KeyDefinition AES192
Field Value
AES256
Represents an AES key with a length of 256 bits.
public static readonly KeyDefinition AES256
Field Value
Ed25519
Represents an Ed25519 key.
public static readonly KeyDefinition Ed25519
Field Value
P256
Represents an EC key with a length of 256 bits.
public static readonly KeyDefinition P256
Field Value
P384
Represents an EC key with a length of 384 bits.
public static readonly KeyDefinition P384
Field Value
P521
Represents an EC key with a length of 521 bits.
public static readonly KeyDefinition P521
Field Value
RSA1024
Represents an RSA key with a length of 1024 bits.
public static readonly KeyDefinition RSA1024
Field Value
RSA2048
Represents an RSA key with a length of 2048 bits.
public static readonly KeyDefinition RSA2048
Field Value
RSA3072
Represents an RSA key with a length of 3072 bits.
public static readonly KeyDefinition RSA3072
Field Value
RSA4096
Represents an RSA key with a length of 4096 bits.
public static readonly KeyDefinition RSA4096
Field Value
TripleDes
Represents a Triple DES key with a length of 192 bits.
public static readonly KeyDefinition TripleDes
Field Value
X25519
Represents an X25519 key.
public static readonly KeyDefinition X25519
Field Value
Properties
All
Gets all key definitions.
public static IReadOnlyDictionary<KeyType, KeyDefinition> All { get; }
Property Value
- IReadOnlyDictionary<KeyType, KeyDefinition>
A collection of key definitions.
Methods
GetByCoseCurve(CoseEcCurve)
Gets a key definition by its curve type.
public static KeyDefinition GetByCoseCurve(CoseEcCurve curve)
Parameters
curve
CoseEcCurveThe curve type of the key.
Returns
- KeyDefinition
The key definition for the specified curve type.
Exceptions
- InvalidOperationException
When the curve type is not supported.
GetByKeyType(KeyType)
Gets a key definition by its type.
public static KeyDefinition GetByKeyType(KeyType type)
Parameters
type
KeyTypeThe type of the key.
Returns
- KeyDefinition
The key definition for the specified key type.
Exceptions
- InvalidOperationException
When the key type is not supported.
GetByOid(Oid)
Gets a key definition by its object identifier (OID).
public static KeyDefinition GetByOid(Oid oid)
Parameters
oid
OidThe object identifier (OID) of the key.
Returns
- KeyDefinition
The key definition for the specified OID.
Exceptions
- NotSupportedException
When the OID is not supported or when the OID is for an RSA key.
GetByOid(string)
Gets a key definition by its object identifier (OID).
public static KeyDefinition GetByOid(string oid)
Parameters
oid
stringThe object identifier (OID) of the key.
Returns
- KeyDefinition
The key definition for the specified OID.
Exceptions
- NotSupportedException
When the OID is not supported or when the OID is for an RSA key.
GetByRSALength(int)
Gets a key definition by its RSA key length.
public static KeyDefinition GetByRSALength(int keySizeBits)
Parameters
keySizeBits
intThe length of the RSA key in bits.
Returns
- KeyDefinition
The key definition for the specified RSA key length.
Exceptions
- NotSupportedException
When the RSA key length is not supported.
GetByRSAModulusLength(byte[])
public static KeyDefinition GetByRSAModulusLength(byte[] modulus)
Parameters
modulus
byte[]
Returns
GetEcKeyDefinitions()
Gets all elliptic curve (EC) key definitions.
public static IReadOnlyCollection<KeyDefinition> GetEcKeyDefinitions()
Returns
- IReadOnlyCollection<KeyDefinition>
A collection of EC key definitions.
GetKeyTypeByOid(Oid)
public static KeyType GetKeyTypeByOid(Oid algorithmOid)
Parameters
algorithmOid
Oid
Returns
GetKeyTypeByOid(string)
public static KeyType GetKeyTypeByOid(string algorithmOid)
Parameters
algorithmOid
string
Returns
GetRsaKeyDefinitions()
Gets all RSA key definitions.
public static IReadOnlyCollection<KeyDefinition> GetRsaKeyDefinitions()
Returns
- IReadOnlyCollection<KeyDefinition>
A collection of RSA key definitions.