Table of Contents

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
object
KeyDefinitions

Fields

AES128

Represents an AES key with a length of 128 bits.

public static readonly KeyDefinition AES128

Field Value

KeyDefinition

AES192

Represents an AES key with a length of 192 bits.

public static readonly KeyDefinition AES192

Field Value

KeyDefinition

AES256

Represents an AES key with a length of 256 bits.

public static readonly KeyDefinition AES256

Field Value

KeyDefinition

Ed25519

Represents an Ed25519 key.

public static readonly KeyDefinition Ed25519

Field Value

KeyDefinition

P256

Represents an EC key with a length of 256 bits.

public static readonly KeyDefinition P256

Field Value

KeyDefinition

P384

Represents an EC key with a length of 384 bits.

public static readonly KeyDefinition P384

Field Value

KeyDefinition

P521

Represents an EC key with a length of 521 bits.

public static readonly KeyDefinition P521

Field Value

KeyDefinition

RSA1024

Represents an RSA key with a length of 1024 bits.

public static readonly KeyDefinition RSA1024

Field Value

KeyDefinition

RSA2048

Represents an RSA key with a length of 2048 bits.

public static readonly KeyDefinition RSA2048

Field Value

KeyDefinition

RSA3072

Represents an RSA key with a length of 3072 bits.

public static readonly KeyDefinition RSA3072

Field Value

KeyDefinition

RSA4096

Represents an RSA key with a length of 4096 bits.

public static readonly KeyDefinition RSA4096

Field Value

KeyDefinition

TripleDes

Represents a Triple DES key with a length of 192 bits.

public static readonly KeyDefinition TripleDes

Field Value

KeyDefinition

X25519

Represents an X25519 key.

public static readonly KeyDefinition X25519

Field Value

KeyDefinition

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 CoseEcCurve

The 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 KeyType

The 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 Oid

The 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 string

The 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 int

The 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

KeyDefinition

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

KeyType

GetKeyTypeByOid(string)

public static KeyType GetKeyTypeByOid(string algorithmOid)

Parameters

algorithmOid string

Returns

KeyType

GetRsaKeyDefinitions()

Gets all RSA key definitions.

public static IReadOnlyCollection<KeyDefinition> GetRsaKeyDefinitions()

Returns

IReadOnlyCollection<KeyDefinition>

A collection of RSA key definitions.