CoseEcPublicKey Class
Namespace: Yubico.YubiKey.Fido2.Cose Assembly: Yubico.YubiKey.dllA representation of an Elliptic Curve public key in COSE form.
public class CoseEcPublicKey : CoseKey, ICborEncode
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 |
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. |
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 |
---|---|
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 |