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
.
public override bool TryDecode(ReadOnlyMemory<byte> encodedData)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | encodedData | The data to parse. |
Returns
A boolean, true
if the method successfully decodes,
false
otherwise.
Overrides
Exceptions
Type | Condition |
---|---|
System.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
.