Parses a single primitive or constructed TLV encoded data object from the given raw data.

Namespace: CardWerk.SmartCard
Assembly: CardWerk.SmartCard (in CardWerk.SmartCard.dll)

Public Shared Function Parse( _ 
ByVal vbData As Byte(), _ 
ByRef nOffset As Integer, _ 
ByRef nLength As Integer, _ 
ByVal nEncoding As CardDataObjectEncoding
) As CardDataObject
This language is not supported or no code example is available.
public static CardDataObject Parse( 
byte[] vbData
ref int nOffset
ref int nLength
CardDataObjectEncoding nEncoding 
)
This language is not supported or no code example is available.
public:  
static CardDataObject^ Parse( 
array< Byte >^ vbData
int& nOffset
int& nLength
CardDataObjectEncoding nEncoding 
)
This language is not supported or no code example is available.
public static function Parse( 
vbData : byte[], 
nOffset : int
nLength : int
nEncoding : CardDataObjectEncoding 
) : CardDataObject;
This language is not supported or no code example is available.

Parameters

vbData
Type: byte[]

Provides the raw binary data to be parsed. Must not be null.

nOffset
Type: int

[in,out] Offset in data array where parsing shall begin. This is updated to the offset of the first byte after the parsed data object on return. Thus it is possible to repeatedly call this method in order to parse a sequence of data objects.

nLength
Type: int

[in,out] Maximum number of bytes to consume from the given data array. If the parsed data object is bigger than the remaining length, then a System.FormatException will be thrown. On return this parameter is reduced by the amount of bytes actually consumed. The initial must not be gibber than 65535 or be negative.

nEncoding
Type: CardDataObjectEncoding

The expected type of TLV encoding. Through this parameter the caller can specify whether the data is BER-TLV or SIMPLE-TLV encoded.

Return Value

Type: CardDataObject

Returns the parsed TLV data object inside a newly created CardDataObject instance. All data is copied from the given vbData array into newly created arrays owned by the created CardDataObject instance.

If the nLength was zero, or the data only contains empty filler bytes, then null is returned. In this case the returned final nLength will be zero, too.

Exception type Condition

ArgumentOutOfRangeException

Thrown when one or more arguments are outside the required range.

ArgumentNullException

Thrown when one or more required arguments are null.

FormatException

Thrown when the format of the ? is incorrect.

If the data is BER-TLV encoded and the parsed tag indicates a constructed data object, then it will be recursively parsed until all contained data objects have also been parsed. Thus effectively returning a tree of CardDataObject instances.

Any empty filler bytes with the value 0x00 or 0xFF that are preceeding the tag will be skipped. Inside constructed data objects any empty filler bytes before, between or after the actual BER-TLV data objects are skipped, too.

If the parsed data is an invalid TLV encoding, or is an incomplete TLV data object, then a System.FormatException will be thrown.

.NET Framework

Supported in: 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

.NET Core

Supported in: 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0

.NET Standard

Supported in: 2.0