PCSC.Iso7816
Application Protocol Data Unit (APDU), defined by the ISO/IEC 7816 standards
The currently used ISO case.
The currently used protocol.
Converts the APDU structure to a transmittable byte array.
A byte array containing the APDU parameters and data in the correct order.
Indicates if the APDU is valid.
if the APDU is valid.
Converts the APDU structure to a transmittable byte array.
The APDU.
The supplied APDU as byte array.
Coding and meaning of the class byte
The structure and coding of command and response are as described in ISO/IEC 7816. 'x' contains the options for secure messaging and the logical channel.
Reserved for future use.
Reserved for future use.
Reserved for future use.
Reserved for future use.
Reserved for future use.
Reserved for future use.
Reserved for future use.
The structure of command and response are as described in ISO/IEC 7816. 'x' contains the options for secure messaging and the logical channel.
The coding (and meaning) of command and response are proprietary.
The structure of command and response are as described in ISO/IEC 7816. 'x' contains the options for secure messaging and the logical channel.
The coding (and meaning) of command and response are proprietary.
If not specified by the application context, structure and coding of command and response are as described in ISO/IEC 7816. 'x' contains the options for secure messaging and the logical channel.
The structure of command and response are as described in ISO/IEC 7816.
The structure of command and response are as described in ISO/IEC 7816.
The structure of command and response are proprietary.
The structure of command and response are proprietary.
The structure of command and response are proprietary.
A class the can be used to build or parse the CLA (Class byte) of a APDU.
Initializes a new instance of the class.
The CLA as byte that will be parsed.
Initializes a new instance of the class.
The high part of the CLA
The secure messaging format.
The logical channel number.
logicalChannelNumber;Logical channels must be in the range between 0 and 3.
Returns the CLA as byte.
Gets or sets the high part of the CLA
The high part of the CLA.
Gets or sets the secure messaging (SM) format.
Gets or sets the logical channel number.
The logical channel number.
value;Logical channels must be in the range between 0 and 3.
Implicitly converts a to a .
The CLA as byte
Implicitly converts a to an instance.
CLA as byte.
The parsed CLA.
A Command Application Protocol Data Unit (APDU), defined by the ISO/IEC 7816 standards
A can be build using one of the following :
CaseAPDU structure
- 1CLA INS P1 P2
- 2CLA INS P1 P2 Le
- 3CLA INS P1 P2 Lc Data
- 4CLA INS P1 P2 Lc Data Le
See the documentation for for more information.
Initializes a new instance of the class.
The ISO case to use.
The protocol.
Gets or sets the CLA byte.
You can use the class to build a well formed CLA byte.
Gets the CLA.
The as instance.
Gets the instruction byte info.
The as instance.
Gets or sets the instruction.
Sets the instruction.
The first parameter (P1)
The second parameter (P2)
A combination of parameter P1 and P2
Command APDU data to be transmitted.
You can only set data if you created the with ISO case 3 or 4.
Length command
The third parameter (P3 or Le)
Length expected.
This is the expected number of response data bytes. Do not take account of the status word (SW1 and SW2) here!
The expected response size (Le + SW1SW2)
Calculates the APDU size in bytes.
The APDU size in bytes depending on the currently selected ISO case.
Converts the command APDU to a transmittable byte array.
The command APDU as byte array.
If the command APDU is in an invalid state.
Indicates if the command APDU is valid.
if the APDU is valid.
Creates a clone of the current instance. The data is NOT copied.
A clone of the current instance.
Creates a GET RESPONSE command after receiving SW1=0x61 (More data available)
The initial command that has been sent to the card
The received response
The expected size
A GET RESPONSE APDU
Category of file types
Working elementary file (Working EF) that is intended for storing data not interpreted by the card.
Internal elementary file (Internal EF) that is intended for storing data interpreted and/or analyzed by the card and for control purposes.
Proprietary file type.
Dedicated file (DF) that is used for logical organization of data in a card.
A file descriptor. See ISO/IEC7816-4 File control information (FCI) for more information.
File type bit mask.
Dedicated file (DF) bit.
Working elementary file (EF) bit.
Internal elementary file (EF) bit.
Sharemode bit mask.
Shareable bit.
Non shareable bit.
The file descriptor as single byte structure.
Gets the file type.
Gets the extended file type.
Gets the file sharing mode.
Gets file structure information.
Initializes a new instance of the class.
The file descriptor byte that shall be parsed.
Determines whether the specified bits are set.
The a bit mask.
The bits to check for.
true if the specified bits are set; otherwise, false.
Implicitly converts a to a single byte.
The file descriptor.
A file descriptor as byte.
Implicitly converts a single byte to a .
The file descriptor as byte.
A instance as parsed result.
File share mode
Shareable file that supports at least concurrent access on different logical channels.
Non shareable file.
File structure information for elementary file (EF).
File structure mask bits.
File has not structure information bit.
Transparent bit.
Linear fixed bit.
Linear fixed TLV bit.
Linear variable bit.
Linear variable TLV bit.
Cyclic bit.
Cyclic TLV bit.
Initializes a new instance of the class.
The file descriptor containing the file structure information.
Gets the file structure type.
Gets a value indicating whether the structuring method is a transparent EF.
Gets the record information.
Returns a instance if the file structuring method is a record EF. Otherwise .
Gets the file descriptor.
The file descriptor as byte.
Gets a value indicating whether the structuring method is a record EF.
true if the EF is record; otherwise, false.
File structure types
The following structures of elementary files are defined:
- Transparent structure; the EF contains a sequence of data units.
- Record structure; the EF contains a sequence of individually identifiable records.
When using a record structure, the size of the particular records is either fixed or variable. Furthermore records are organized as a sequence (linear) or as a ring (cyclic).
No information about file structure given
Transparent. The EF has a sequence of data units
Linear fixed, no further info
Linear fixed SIMPLE-TLV (Type-length-value)
Linear variable, no further info
Linear variable SIMPLE-TLV (Type-length-value)
Cyclic, no further info
Cyclic, SIMPLE-TLV (Type-length-value)
File type
Dedicated file (DF) that is used for logical organization of data in the card.
Elementary file (EF) that is used for storing data.
The data may or may not be interpreted/analyzed by the card. You need to check the extended file type .
A ISO/IEC 7816 compliant reader.
Gets the name of the reader.
Gets the active protocol.
Gets the current share mode.
Gets or sets the wait time in milliseconds that is used if an APDU needs to be retransmitted.
Gets the maximum number of bytes that can be received.
Constructs a command APDU using the active protocol of the reader.
The ISO case that shall be used for this command.
An empty command APDU.
Connects the specified reader.
Name of the reader.
The share mode.
The communication protocol.
Disconnects the currently connected reader.
The action that shall be executed after disconnect.
Transmits the specified command APDU.
The command APDU.
A response containing one ore more .
A class that describes the instruction of a command APDU.
Initializes a new instance of the class.
The instruction code.
Initializes a new instance of the class.
The instruction as byte.
Gets or sets the instruction code.
Gets or sets the instruction as value.
Implicitly converts a to a single INS byte.
A byte containing INS.
Implicitly converts a byte to a instance.
The instruction as byte.
A class
Implicitly converts a to a instance.
The instruction code.
A instance
Basic instruction codes defined in ISO/IEC 7816-4
Erase binary
Verify
Manage channel
External authenticate
Get challenge
Internal authenticate
Select file
Read binary
Read record(s)
Get response
Envelope
Get data
Write binary
Write record
Update binary
Put data
Update data
Append record
Decrement value
Increment value
The APDU is invalid.
APDU bytes
APDU
Initializes a new instance of the class.
The error message.
Initializes a new instance of the class.
The error message.
The inner exception.
Initializes a new instance of the class.
The error message.
The APDU.
The inner exception.
Initializes a new instance of the class.
APDU message structure for the command-response pair.
ISO caseCommand data, Expected response data
- 1Command: no data, Expected response: no data
- 2Command: no data, Expected response: data
- 3Command: data, Expected response: no data
- 4Command: data, Expected response: data
In the card capabilities, the card states that the Lc and the Le field should either be short or extended. A short command has one byte for each length field, an extended command has two bytes for each length field.
No command data. No response data.
- Lc is valued to 0.
- Le is valued to 0.
- No data byte is present.
No command data. Expected response data.
- Lc is valued to 0.
- Le is valued from 1 to 256.
- No data byte is present.
Command data. No response data.
- Lc is valued from 1 to 255.
- Le is valued to 0.
- Lc data bytes are present.
Command data. Expected response data.
- Lc is valued from 1 to 255.
- Le is valued from 1 to 256.
- Lc data bytes are present.
No command data. Expected response data.
- Lc is valued to 0.
- Le is valued from 1 to 65536.
- No data byte is present.
Command data. No response data.
- Lc is valued from 1 to 65536.
- Le is valued to 0.
- Lc data bytes are present.
Command data. Expected response data.
- Lc is valued from 1 to 65535.
- Le is valued from 1 to 65536.
- Lc data bytes are present.
A ISO/IEC 7816 compliant reader.
Gets the name of the reader.
Gets the active protocol.
Gets the current share mode.
Gets or sets the wait time in milliseconds that is used if an APDU needs to be retransmitted.
Default is 0 ms
Gets the maximum number of bytes that can be received (le) when using a command.
Default is 128 bytes.
Finalizes an instance of the class.
Initializes a new instance of the class.
The supplied reader will be used for communication with the smart card.
if set to true the supplied will be disconnected on .
If reader is
Initializes a new instance of the class and immediately connects to the reader.
The supplied reader will be used for communication with the smart card.
Name of the reader to connect with.
The share mode.
The communication protocol.
if set to true the supplied will be disconnected on .
Initializes a new instance of the class that will create its own instance of a .
A context to the PC/SC Resource Manager.
if set to true the will be released on .
If is
Initializes a new instance of the class that will create its own instance of a and immediately connect.
A context to the PC/SC Resource Manager.
Name of the reader to connect with.
The share mode.
The communication protocol.
if set to true the will be released on .
Initializes a new instance of the class that will create its own instance of a and immediately connect.
A context to the PC/SC Resource Manager.
Name of the reader to connect with.
The share mode.
The communication protocol.
if set to true the will be released on .
Sets the maximum number of bytes that can be received (Le) when using a command.
Constructs a command APDU using the active protocol of the reader.
The ISO case that shall be used for this command.
An empty command APDU.
Connects the specified reader.
Name of the reader.
The share mode.
The communication protocol.
Disconnects the currently connected reader.
The action that shall be executed after disconnect.
Transmits the specified command APDU.
The command APDU.
A response containing one ore more .
Transmits the specified command APDU.
The command APDU.
A method that will be called if the card signals more data available (SW1=0x61)
A response containing one ore more .
Creates a GET RESPONSE command after receiving SW1=0x61 (More data available)
The initial command that has been sent to the card
The received response
The expected size
A GET RESPONSE APDU
Releases unmanaged and managed resources.
Releases unmanaged and - optionally - managed resources.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Record structure information.
Elementary files (EF) that have a sequence of individually identifiable records should use one of the following methods for structuring:
- Linear elementary file (EF) with records of variable size.
- Linear elementary file (EF) with records of fixed size.
- Cyclic elementary file (EF) with records of fixed size.
File structuring mask bits.
Linear fixed bit.
Linear variable bit.
Cyclic bit.
Initializes a new instance of the class.
The file descriptor.
Gets a value indicating whether the EF has cyclic records.
true if the EF is cyclic; otherwise, false.
Gets a value indicating whether the EF has linear records.
true if the EF is linear; otherwise, false.
Gets a value indicating whether the EF's record size is fixed.
true if the record's size is fixed; otherwise, false.
Gets a value indicating whether the EF's record size is variable.
true if the record's size is variable; otherwise, false.
Gets a value indicating whether the EF contains simple TLV records.
true if the EF contains simple TLV records; otherwise, false.
Gets the file descriptor.
The file descriptor as byte.
An aggregation of instances.
When using the result can consist of one or more . If the receives a SW1=0x61 status word, it will automatically transmit a GET RESPONSE command to reader (after waiting ms) to catch all remaining .
Gets the at the specified index.
The .
The index.
The at the specified index.
The SW1 status of the last received .
The SW2 status of the last received .
Gets the number of received .
Gets the number of received .
A combination of SW1 and SW2 as 16bit status word.
It contains the status word of the last received .
if at least one contains data bytes.
Initializes a new instance of the class.
Creates a new instance.
The s in correct order.
The in correct order.
Adds the specified response APDU.
The response APDU.
Adds the specified PCI.
The PCI.
An aggregation of all data bytes in receive order.
An aggregation of all data bytes from all .
Gets the of the specified index.
The index.
The of the specified index.
Gets the of the specified index.
The index.
The of the specified index.
A response APDU
Initializes a new instance of the class.
The response as byte array that shall be parsed.
The ISO case that was used when sending the .
The communication protocol.
Initializes a new instance of the class.
The response as byte array that shall be parsed.
The ISO case that was used when sending the .
The communication protocol.
If the bytes of the supplied response will be copied.
Initializes a new instance of the class.
The response as byte array that shall be parsed.
The size of the response.
The ISO case that was used when sending the .
The communication protocol.
If is greater than the size.
Initializes a new instance of the class.
The response as byte array that shall be parsed.
The size of the response.
The ISO case that was used when sending the .
The communication protocol.
If the bytes of the supplied response will be copied.
If is greater than the size.
Gets a value indicating whether this response has data.
true if this response has data; otherwise, false.
Indicates if the response APDU is valid.
if the response APDU is valid.
Gets the SW1 status byte.
The response APDU is invalid.
Gets the SW1 status byte.
The response APDU is invalid.
Gets the combination of SW1 and SW2 as 16bit status word.
The response APDU is invalid.
Gets the length of the response APDU
Gets the size of the data.
Gets the full response APDU.
The full APDU as byte array.
Gets the data.
The data.
The response APDU is invalid.
Converts the APDU structure to a transmittable byte array.
A byte array containing the APDU parameters and data in the correct order.
Creates a clone.
A clone of the current instance.
A enumerator.
Returns the current element.
The current element.
if the enumerator reaches the end and therefore is invalid.
Returns the current element.
The current element.
if the enumerator reaches the end and therefore is invalid.
Initializes a new instance of the class.
A list of .
Initializes a new instance of the class.
An enumeration of .
Initializes a new instance of the class.
An array of .
Returns an enumerator.
A objekt, that can be used to enumerate through all .
Returns an enumerator.
A objekt, that can be used to enumerate through all .
Sets the enumerator the the next element.
true if there exists another element. Otherwise false.
Resets the enumerator to the beginning.
Disposes the enumerator and releases all managed resources.
Releases unmanaged and - optionally - managed resources.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Secure messaging (SM) format
No secure messaging
Proprietary secure messaging format
Command header not authenticated
Command header authenticated
Meaning for the first status word SW1 (ISO7816-4).
Normal data response. SW2 indicates the number of remaining response bytes.
Warning. The state of non-volatile memory has not been changed.
SW2 could have one of the following values:
SW2Meaning
- 0x00No information.
- 0x81Returned data may be corrupted.
- 0x82End of file or end of record reached. The number of bytes read is less than specified in
- 0x83The selected file invalidated.
- 0x84FCI is not correctly formatted.
Warning. The state of non-volatile memory has been changed.
SW2 could have one of the following values:
SW2Meaning
- 0x00No information.
- 0x81File filled up.
An error occurred. The state of non-volatile memory has not been changed.
SW2 should be 0x00.
An error occurred. The state of non-volatile memory has been changed.
SW2 could have one of the following values:
SW2Meaning
- 0x00No information.
- 0x81Memory failure.
An security error occurred.
Error wrong length.
The function defined in CLA is not supported.
SW2 could have one of the following values:
SW2Meaning
- 0x00No information.
- 0x81Logical channel not supported
- 0x82Secure messaging not supported
Error command not allowed
SW2 could have one of the following values:
SW2Meaning
- 0x00No information.
- 0x81The command is not compatible with the file structure.
- 0x82The security status is not satisfied.
- 0x83The authentication method is blocked.
- 0x84The referenced data has been invalidated.
- 0x85The conditions are not satisfied.
- 0x86The command is not allowed. No current elementary file (EF).
- 0x87Expected secure messaging data objects are missing.
- 0x88Secure messaging data objects are incorrect.
Error wrong parameters P1 and P2
SW2 could have one of the following values:
SW2Meaning
- 0x00No information.
- 0x80The parameters in the data field are incorrect.
- 0x81The requested function is not supported.
- 0x82File not found.
- 0x83Record not found.
- 0x84The file has not enough free space.
- 0x85The parameter is inconsistent with the TLV structure.
- 0x86The parameters and are incorrect.
- 0x87 is not consistent with .
- 0x88The referenced data was not found.
Error wrong parameters P1 and P2
has the wrong length.
SW2 contains the exact length.
The instruction code is invalid or not supported.
The Class is not supported.
No precise diagnosis available.
Normal data response.
Error purse balance.
Memory error.
File error.
Error authorization.
Normal GET response
TLV (tag-length-value) type.
Simple
ASN.1 (abstract syntax notation) structured using basic encoding rules defined in ISO/IEC8825.