Table of Contents

Class SetManagementKeyResponse

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

The result of setting the value of the PIV management key.

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

Remarks

This is the partner Response class to SetManagementKeyCommand

To determine the result of the command, look at the Status. If Status is not one of the following values then an error has occurred.

StatusDescription
SuccessManagement key was set successfully.
AuthenticationRequiredManagement key was not verified.

Example:

/* This example assumes the application has a method to collect a
 * management key.
 */
using System.Security.Cryptography;
byte[] mgmtKey;
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
mgmtKey = CollectMgmtKey();
var setManagementKeyCommand =
    new SetManagementKeyCommand(PivTouchPolicy.Never, mgmtKey);
SetManagementKeyResponse setManagementKeyResponse =
     connection.SendCommand(setManagementKeyCommand);
if (setManagementKeyResponse != ResponseStatus.Success)
{
  // Handle error
}

CryptographicOperations.ZeroMemory(mgmtKey);

Constructors

SetManagementKeyResponse(ResponseApdu)

Constructs a SetManagementKeyResponse based on a ResponseApdu received from the YubiKey.

public SetManagementKeyResponse(ResponseApdu responseApdu)

Parameters

responseApdu ResponseApdu

The object containing the response APDU
returned by the YubiKey.