Table of Contents

Class ImportAsymmetricKeyResponse

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

The response to the import asymmetric key command, containing the result of the import process.

public class ImportAsymmetricKeyResponse : PivResponse, IYubiKeyResponse
Inheritance
object
ImportAsymmetricKeyResponse
Implements
Inherited Members

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

ImportAsymmetricKeyResponse(ResponseApdu)

Constructs an ImportAsymmetricKeyResponse based on a ResponseApdu received from the YubiKey.

public ImportAsymmetricKeyResponse(ResponseApdu responseApdu)

Parameters

responseApdu ResponseApdu

The object containing the response APDU
returned by the YubiKey.