Table of Contents

Class PutDataResponse

Namespace
Yubico.YubiKey.Piv.Commands
Assembly
Yubico.YubiKey.dll

The response to the PUT DATA command.

public sealed class PutDataResponse : PivResponse, IYubiKeyResponse
Inheritance
object
PutDataResponse
Implements
Inherited Members

Remarks

This is the partner Response class to PutDataCommand.

There is no data returned by this class (no GetData method). To determine the result of the command, look at the Status property.

There are two possible outcomes: (1) the data was PUT (Success), (2) an error occurred. For example, if the management key or PIN was not verified, the Status would be AuthenticationRequired.

Example:

/* This example assumes there is some code that will build an encoded
   certificate from an X509Certificate2 object. */
byte[] encodedCertificate = PivPutDataEncodeCertificate(certObject);
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
PutDataCommand putDataCommand = new PutDataCommand(
    PivDataTag.Authentication, encodedCertificate);
PutDataResponse putDataResponse = connection.SendCommand(putDataCommand);
if (getDataResponse.Status != ResponseStatus.Success)
{
    /* handle case where the the PUT did not work. */
}

Constructors

PutDataResponse(ResponseApdu)

Constructs a PutDataResponse object based on a ResponseApdu received from the YubiKey.

public PutDataResponse(ResponseApdu responseApdu)

Parameters

responseApdu ResponseApdu

The object containing the response APDU
returned by the YubiKey.