Show / Hide Table of Contents

CoseEcPublicKey Class

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

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

C#
public class CoseEcPublicKey : CoseKey
Inheritance object CoseKey CoseEcPublicKey

Remarks

An ECC public key consists of a curve and public point. In FIDO2, the curve is represented by the CoseAlgorithmIdentifier and the public point is simply an x-coordinate and a y-coordinate.

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()`).

This class has multiple constructors. One constructs an empty object and allows the caller to set the key parameters via the properties on this class. Another constructs a key based on the COSE form encoded in CBOR. Lastly, there is a constructor that takes in a .NET representation of an EC public key used for interoperating with the .NET cryptographic library.

The YubiKey's FIDO2 application currently only supports the NIST P-256 curve. Thus, the SDK - as of version 1.5.0 - will also only support this curve.

Constructors

Name Description
CoseEcPublicKey(ReadOnlyMemory<byte>)

Construct a CoseEcPublicKey based on the CBOR encoding of a COSE_Key.

CoseEcPublicKey(ECParameters)

Construct a CoseEcPublicKey based on .NET elliptic curve parameters.

CoseEcPublicKey(CoseEcCurve, ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)

Construct a CoseEcPublicKey based on the curve and point.

CoseEcPublicKey(CoseEcCurve, CoseAlgorithmIdentifier, ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)

Construct a CoseEcPublicKey based on the curve and x and y coordinates.

Properties

Name Description
Curve

The Elliptic Curve that the key resides on.

XCoordinate

The X-coordinate of the public point.

YCoordinate

The Y-coordinate of the public point.

Methods

Name Description
CreateFromEncodedKey(ReadOnlyMemory<byte>)

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

Encode()

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

ToEcParameters()

Returns the COSE key as a new .NET ECParameters structure. Used for interoperating with the .NET crypto library.

In this article
Back to top Generated by DocFX