Show / Hide Table of Contents

TryDecode Method

TryDecode(ReadOnlyMemory<byte>)

Try to decode the data given according to the format specified for the data object. If successful, return true, otherwise, return false.

C#
public override bool TryDecode(ReadOnlyMemory<byte> encodedData)

Parameters

Type Name Description
ReadOnlyMemory<byte> encodedData

The data to parse.

Returns

bool

A boolean, true if the method successfully decodes, false otherwise.

Overrides

PivDataObject.TryDecode(ReadOnlyMemory<byte>)

Exceptions

Type Condition
ArgumentException

The data is not properly encoded for the data object.

Remarks

This will parse the encoding and set local properties with the data. The encodedData generally was retrieved from the YubiKey.

This will replace any data in the object.

If there is no data (encodedData.Length is 0) this method will set the object to the empty state (IsEmpty will be true and the contents of any data properties will be meaningless) and return true.

If the input is not encoded as expected, this method will set the object to the empty state and return false. This includes the fixed values. That is, there are some values in some data objects that are fixed for every YubiKey, and this method will expect the contents of the encodedData to contain those fixed values.

If the input is encoded as expected, yet the data in that encoding is invalid (e.g. some element is not the correct length), this method will return false.

In this article
Back to top Generated by DocFX