Cryptware

Implements an APDU Command

Namespace:  Cryptware.NSCAPI
Assembly:  NSCAPI (in NSCAPI.dll)

Syntax

Visual Basic (Declaration)
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDual)> _
<GuidAttribute("FA196208-4376-4a47-9800-75E7F26F2218")> _
Public Class CommandAPDU _
	Implements ICommandAPDU
C#
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDual)]
[GuidAttribute("FA196208-4376-4a47-9800-75E7F26F2218")]
public class CommandAPDU : ICommandAPDU
Visual C++
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDual)]
[GuidAttribute(L"FA196208-4376-4a47-9800-75E7F26F2218")]
public ref class CommandAPDU : ICommandAPDU
JavaScript
Cryptware.NSCAPI.CommandAPDU = function();

Type.createClass(
	'Cryptware.NSCAPI.CommandAPDU',
	null,
	Cryptware.NSCAPI.ICommandAPDU);

Remarks

A smart card command is encoded in a Command APDU.
A T = 1 Command APDU is similar to a record made by seven fields, each one 8-bit length: CLA (Class), INS ( INS (Class Instruction), P1 (Parameter 1), P2 (Parameter 2 ), LC (Length of the Command), DATA (Command DATA), LE (Length of Expected). The first four fields represent a mandatory header specifying a particular command, the three remaining fields identify an optional body containing eventual input parameters. The CLA byte indicates the class to which the command belongs (that is in which section of ISO 7816 standard defines the command or if it is included in a proprietary set of commands) and the submission mode (normal or SM). The INS field individuates a command inside the class specified by CLA. P1 and P2 are both additional parameters specific to a particular command. The LC field holds the length of the following DATA field (though, it could be omitted if there is no DATA field). DATA contains all data being processed via the command (for example, data being written in a file). Finally, LE specifies the response’s expected length sent by the microchip for the command.
A T = 0 Command APDU is a bit different from the T = 1 ones. T = 0 splits commands APDUs in APDUs for writing and for reading (differently from T = 1 where an APDU can write data and receive response data at the same time). In other words a T = 0 a command APDU which writes data cannot receive response data other than the status words (see next paragraph).
A T = 0 Command APDU has CLA, INS, P1 and P2 but defines P3 as the length of DATA field if it is a writing APDU (i.e. the purpose of the command is to send something to the smart card; it stands for LC) or as the length of the expected response if it is a reading APDU (i.e. the purpose of the command is to read something from the smart card; it stands for LE).
Each APDU Command is executed by the smart card operating system and affects the currently selected EF or Dedicated File (at startup Master File is automatically selected).

Inheritance Hierarchy

System..::.Object
  Cryptware.NSCAPI..::.CommandAPDU

See Also