Table of Contents

Class CommandApdu

Namespace
Yubico.Core.Iso7816
Assembly
Yubico.Core.dll

Represents an ISO 7816 application command

public class CommandApdu
Inheritance
object
CommandApdu

Constructors

CommandApdu()

Initializes a new instance of the CommandApdu class.

public CommandApdu()

Properties

Cla

Indicates the class of the instruction.

public byte Cla { get; set; }

Property Value

byte

Data

Gets or sets the optional command data payload.

public ReadOnlyMemory<byte> Data { get; set; }

Property Value

ReadOnlyMemory<byte>

Ins

Indicates the command or instruction to process.

public byte Ins { get; set; }

Property Value

byte

Nc

The number of bytes in Data.

public int Nc { get; }

Property Value

int

Remarks

If Data is null, returns 0.

Ne

The maximum number of bytes expected in the response data. Must be a non-negative number.

public int Ne { get; set; }

Property Value

int

Remarks

Values of note:

P1

First parameter byte.

public byte P1 { get; set; }

Property Value

byte

P2

Second parameter byte.

public byte P2 { get; set; }

Property Value

byte

Methods

AsByteArray()

Transforms the CommandApdu into an array of bytes.

public byte[] AsByteArray()

Returns

byte[]

An array of bytes representing an ISO 7816 CommandApdu.

Remarks

Automatically determines the appropriate encoding to use. See also AsByteArray(ApduEncoding).

Exceptions

InvalidOperationException

Thrown when no valid ApduEncoding scheme is found for the current state of CommandApdu.

AsByteArray(ApduEncoding)

Transforms the CommandApdu into an array of bytes.

public byte[] AsByteArray(ApduEncoding apduEncoding)

Parameters

apduEncoding ApduEncoding

The ApduEncoding in which the output is written.

Returns

byte[]

An array of bytes representing an ISO 7816 CommandApdu.

Remarks

All CommandApdu fields must be valid for the given apduEncoding.

Exceptions

InvalidOperationException

Thrown when no valid ApduEncoding scheme is found for the current state of CommandApdu.

ArgumentOutOfRangeException

Thrown when apduEncoding is invalid.