Show / Hide Table of Contents

SetManagementKeyResponse Class

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

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

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

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

Name Description
SetManagementKeyResponse(ResponseApdu)

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

In this article
Back to top Generated by DocFX