Table of Contents

Class MoveKeyCommand

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

The MoveKeyCommand is used to move a PIV key from one slot to another. The source slot must not be the Attestation slot, and the destination slot must be empty.

public class MoveKeyCommand : IYubiKeyCommand<MoveKeyResponse>
Inheritance
object
MoveKeyCommand
Implements

Constructors

MoveKeyCommand()

Constructor for the MoveKeyCommand, which is used to move a PIV key from one slot to another. The source slot must not be the Attestation slot, and the destination slot must be empty.

public MoveKeyCommand()

MoveKeyCommand(byte, byte)

Constructor for the MoveKeyCommand, which is used to move a PIV key from one slot to another. The source slot must not be the Attestation slot, and the destination slot must be empty.

public MoveKeyCommand(byte sourceSlot, byte destinationSlot)

Parameters

sourceSlot byte

The Yubikey slot of the key you want to move. This must be a valid slot number.

destinationSlot byte

The target Yubikey slot for the key you want to move. This must be a valid slot number.

Properties

Application

Gets the YubiKeyApplication to which this command belongs. For this command, it's PIV.

public YubiKeyApplication Application { get; }

Property Value

YubiKeyApplication

YubiKeyApplication.Piv

DestinationSlot

The target YubiKey slot for the key you want to move. This must be a valid slot number.

public byte DestinationSlot { get; set; }

Property Value

byte

SourceSlot

The YubiKey slot of the key you want to move. This must be a valid slot number.

public byte SourceSlot { get; set; }

Property Value

byte

Methods

CreateCommandApdu()

Creates and validates the CommandApdu.

public CommandApdu CreateCommandApdu()

Returns

CommandApdu

The CommandApdu that targets the Move operation with the correct parameters

Exceptions

InvalidOperationException

An exception will be thrown upon invalid slot usage. Either one of the slots were the Attestation or the source and destination slot were the same.

CreateResponseForApdu(ResponseApdu)

Creates the MoveKeyResponse from the ResponseApdu data.

public MoveKeyResponse CreateResponseForApdu(ResponseApdu responseApdu)

Parameters

responseApdu ResponseApdu

The return data with which the Yubikey responded to the MoveKeyCommand

Returns

MoveKeyResponse

The MoveKeyResponse for the MoveKeyCommand