SetManagementKeyResponse Class
Namespace: Yubico.YubiKey.Piv.Commands Assembly: Yubico.YubiKey.dllThe result of setting the value of the PIV management key.
C#
public sealed class SetManagementKeyResponse : PivResponse, IYubiKeyResponse
Implements
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.
Status | Description |
---|---|
Success | Management key was set successfully. |
AuthenticationRequired | Management 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. |