Table of Contents

Class CoseEdDsaPublicKey

Namespace
Yubico.YubiKey.Fido2.Cose
Assembly
Yubico.YubiKey.dll

A representation of an Elliptic Curve public key in COSE form.

public class CoseEdDsaPublicKey : CoseKey
Inheritance
object
CoseEdDsaPublicKey
Inherited Members

Remarks

An ECC public key consists of a curve and public key data. In FIDO2, the curve is represented by the CoseAlgorithmIdentifier .

The FIDO2 standard also specifies an encoding of the public key information. It uses the representation defined in RFC8152: CBOR Object Signing and Encryption (COSE) standard. Supplementary information can be found in section 6.5.6 of the CTAP2.1 specification (under the heading `getPublicKey()`).

Properties

Curve

The Elliptic Curve that the key resides on.

public CoseEcCurve Curve { get; set; }

Property Value

CoseEcCurve

Exceptions

NotSupportedException

On set, the curve specified is not supported.

PublicKey

The public key data.

public ReadOnlyMemory<byte> PublicKey { get; set; }

Property Value

ReadOnlyMemory<byte>

Exceptions

ArgumentException

On set, the key data is not the correct length.

Methods

CreateFromEncodedKey(ReadOnlyMemory<byte>)

Creates a new instance of CoseEdDsaPublicKey from the given encoded COSE key.

public static CoseEdDsaPublicKey CreateFromEncodedKey(ReadOnlyMemory<byte> encodedCoseKey)

Parameters

encodedCoseKey ReadOnlyMemory<byte>

The encoded COSE key in CBOR format.

Returns

CoseEdDsaPublicKey

A CoseEdDsaPublicKey object initialized with the provided encoded key data.

Exceptions

Ctap2DataException

Thrown if the encodedCoseKey is not a valid EdDSA Public Key encoding.

CreateFromPublicKeyData(ReadOnlyMemory<byte>)

Construct a CoseEdDsaPublicKey based on public key data (x-coordinate of public key)

public static CoseEdDsaPublicKey CreateFromPublicKeyData(ReadOnlyMemory<byte> publicKey)

Parameters

publicKey ReadOnlyMemory<byte>

The x-coordinate of the public point.

Returns

CoseEdDsaPublicKey

Remarks

The only valid DSA curve is ED25519.

Exceptions

ArgumentException

Thrown if the public key data is not the correct length.

Encode()

Return a new byte array that is the key data encoded following the FIDO2/CBOR standard.

public override byte[] Encode()

Returns

byte[]

The encoded key.

Exceptions

InvalidOperationException

The object contains no key data.