Show / Hide Table of Contents

PutDataResponse Class

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

The response to the PUT DATA command.

C#
public sealed class PutDataResponse : PivResponse, IYubiKeyResponse
Inheritance object YubiKeyResponse PivResponse PutDataResponse
Implements
IYubiKeyResponse

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

Name Description
PutDataResponse(ResponseApdu)

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

In this article
Back to top Generated by DocFX