Table of Contents

Interface IYubiKeyResponseWithData<TData>

Namespace
Yubico.YubiKey
Assembly
Yubico.YubiKey.dll

An interface which allows for retrieval of returned data.

public interface IYubiKeyResponseWithData<out TData> : IYubiKeyResponse

Type Parameters

TData

The type of the data.

Inherited Members

Remarks

Implementations of IYubiKeyResponse which also need to return data should implement this interface. Doing so provides callers a uniform means of retrieving data. Data returned can either be basic data types (strings, integers, etc.) or can be classes or structures representing complex data.

Methods

GetData()

Gets the data from the YubiKey response.

TData GetData()

Returns

TData

The data returned by the YubiKey, presented in a manner specific to each implementation.

Remarks

If the method cannot return the data, it will throw an exception. This happens when the Status property indicates an error, or the data returned from the YubiKey was malformed or incomplete.

For example,

IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
GetDataCommand getDataCommand = new GetDataCommand(PivDataTag.Chuid);
GetDataResponse getDataResponse = connection.SendCommand(getDataCommand);
if (getDataResponse.Status == ResponseStatus.Success)
{
    byte[] getChuid = getDataResponse.GetData();
}