Table of Contents

Interface ICborEncode

Namespace
Yubico.YubiKey.Fido2.Cbor
Assembly
Yubico.YubiKey.dll

An interface for representing a class that can generate a CBOR encoding.

public interface ICborEncode

Remarks

This is generally used to write out an encoded value for the CborWriter.WriteEncodedValue method. For example, suppose we need to write out a CBOR-encoded key as part of a larger CBOR encoding. We already have the CoseKey class which can encode the key. So we don't need to write the encode code again, we just need to get the encoding from the object. The resulting encoding can then be copied into the CBOR structure. An alternative is to get the encoding from the key object and pass it into the CborHelper, but then we need to know if this is encoded or a byte string, and there's the Nullable to deal with. So just implement this interface to indicate that we have an object that can encode itself and to take the output of that encoding and simply copy it into the full structure.

Methods

CborEncode()

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

byte[] CborEncode()

Returns

byte[]

The encoded construct.

Exceptions

InvalidOperationException

The object contains no data.