Show / Hide Table of Contents

GetData Method

GetData()

Gets the data requested from the YubiKey response.

C#
public ReadOnlyMemory<byte> GetData()

Returns

ReadOnlyMemory<byte>

The data in the response APDU, presented as a byte array.

Implements

IYubiKeyResponseWithData<TData>.GetData()

Exceptions

Type Condition
InvalidOperationException

Thrown when Status is not Success.

Remarks

The return is a byte array, the raw data returned by the YubiKey. It is the caller's responsibility to parse that data. For example, if the data returned is a certificate, the caller will likely want to build an X509Certificate object from the data.

It is a good idea to call this method, only if the Status is Success. If it is not Success, an exception will be thrown.

If the Status property is ResponseStatus.NoData, then that particular element is not available. For example, if you request the cert in slot 9A, but there is no cert in slot 9A, then this will be the response. In this case, this method will throw an exception.

If the Status is ResponseStatus.AuthenticationRequired, then the data is not available unless the PIN or management key is entered. In this case, this method will throw an exception.

In this article
Back to top Generated by DocFX