ImportAsymmetricKeyResponse Class
Namespace: Yubico.YubiKey.Piv.Commands Assembly: Yubico.YubiKey.dllThe response to the import asymmetric key command, containing the result of the import process.
C#
public class ImportAsymmetricKeyResponse : PivResponse, IYubiKeyResponse
Implements
Remarks
This is the partner Response class to ImportAsymmetricKeyCommand.
This class does not return any Data (there is no GetData
method).
To determine the status of the command, examine the Status
property.
ResponseStatus.Success
means the command executed correctly. Other
values represent various errors. For example, ResponseStatus.AuthenticationRequired
indicates that the user verification (management key) failed, so the command
was not successful.
Example:
var privateKey = new PivEccPrivateKey(privateValue);
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
var importKeyCommand = new ImportAsymmetricKeyCommand(
privateKey, PivSlot.Signing, PivPinPolicy.Default, PivTouchPolicy.Default);
ImportAsymmetricKeyResponse importAsymmetricKeyResponse =
connection.SendCommand(importAsymmetricKeyCommand);
if (importAsymmetricKeyResponse.Status != ResponseStatus.Success)
{
// Handle error
}
privateKey.Clear();
Constructors
Name | Description |
---|---|
ImportAsymmetricKeyResponse(ResponseApdu) | Constructs an ImportAsymmetricKeyResponse based on a ResponseApdu received from the YubiKey. |