Iso7816 2.0.0

Tools to help you work with the ISO7816 standard.

Install-Package Iso7816 -Version 2.0.0
dotnet add package Iso7816 --version 2.0.0
paket add Iso7816 --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Iso7816 Build status

A library of tools to help you work with the ISO7816 standard, mainly revolving around the building and parsing of APDU commands (ISO7816-4).

Getting started

Grab the package from NuGet, which will install all dependencies.

Install-Package Iso7816

The library is compiled against .NET Standard 2.0 - see here for information on your project's runtime requirements.

Usage

Both Command and Response APDUs can be built using the library. Constraints imposed by the specification will be imposed at the time of building and parsing, such as trying to exceed an acceptable size for certain fields. The following Command APDU cases are supported:

  • Case1
  • Case2S
  • Case3S
  • Case4S
  • Case2E
  • Case3E
  • Case4E

To use Extended mode you must opt in to it by doing the following. This will globally configure the ability to use extended commands:

CommandApdu.AllowExtendedMode = true

ResponseApdu.AllowExtendedMode = true

APDUs can be built from individual elements/fields or parsed from existing collections of bytes:

CommandApdu.Case1(0x00, 0xA4, 0x00, 0x00)

\\ -> 00-A4-00-00

CommandApdu.Parse(new byte[] { 0x00, 0xA4, 0x00, 0x00 })

\\ -> 00-A4-00-00

Once an APDU has been created, its various properties can be mutated - for example, you could add command data to a Case1 Command APDU - doing so would automatically change it to be a Case3S APDU in this instance.

Serialisation

All APDU objects are marked as [Serializable]. The library also includes a handful of Json.NET JsonConverter classes which can be used when serialising APDUs; included are converters that will deal with APDUs whose buffers are in base64 or hex pairs formats.

Iso7816 Build status

A library of tools to help you work with the ISO7816 standard, mainly revolving around the building and parsing of APDU commands (ISO7816-4).

Getting started

Grab the package from NuGet, which will install all dependencies.

Install-Package Iso7816

The library is compiled against .NET Standard 2.0 - see here for information on your project's runtime requirements.

Usage

Both Command and Response APDUs can be built using the library. Constraints imposed by the specification will be imposed at the time of building and parsing, such as trying to exceed an acceptable size for certain fields. The following Command APDU cases are supported:

  • Case1
  • Case2S
  • Case3S
  • Case4S
  • Case2E
  • Case3E
  • Case4E

To use Extended mode you must opt in to it by doing the following. This will globally configure the ability to use extended commands:

CommandApdu.AllowExtendedMode = true

ResponseApdu.AllowExtendedMode = true

APDUs can be built from individual elements/fields or parsed from existing collections of bytes:

CommandApdu.Case1(0x00, 0xA4, 0x00, 0x00)

\\ -> 00-A4-00-00

CommandApdu.Parse(new byte[] { 0x00, 0xA4, 0x00, 0x00 })

\\ -> 00-A4-00-00

Once an APDU has been created, its various properties can be mutated - for example, you could add command data to a Case1 Command APDU - doing so would automatically change it to be a Case3S APDU in this instance.

Serialisation

All APDU objects are marked as [Serializable]. The library also includes a handful of Json.NET JsonConverter classes which can be used when serialising APDUs; included are converters that will deal with APDUs whose buffers are in base64 or hex pairs formats.

Version History

Version Downloads Last updated
2.0.0 144 9/21/2018
1.0.1 382 12/8/2017
1.0.0 191 12/8/2017