C ANSI Library to work with BER-TLV format data.

BER-TLV Challenge Library

As requested a shared library(.so) were developed using C programming language to interpret and works with BER-TLV objects.

The library permits receive one or more BERTLV buffer, loads its respective tags into a linked list, whit allow users applications to perform operations like reading tags in a structured format, searching for a specific tag, add, deleting and also re-encoding the information to a new BER-TLV buffer.

enter image description here


Linked List arctectured

The linked list architecture were chose due to similarity with BER-TLC Tags Tree and advantages to easly permits mamipulations like adding and delete operation with out necessity of memory realocation.

enter image description here


handle instace

Function were designed to work with a handle, so it can be useded for multiple instances like multi-thread application.


Get Start

Clone the repository:

git clone https://github.com/erikrosimoes/BER-TLV-library.git

On root directory performe the follow comands: Create de working directory

make install     

Biuld lib and SampleSoftware

make all        

Run Sample Software that calls BERTLV Library, retrive tags structured data and print TAGs Tree.

./SampleSoftware

Lib Functions

The Library api consists of the functions listed below.

HandleManagement:

bertlvHandleInit:
	- Return a instance handle interface.
	
bertlvHandleFree:
	- Releases handle, must be called to free allocated memory.

Add and Delete Operation:

bertlvLoadBuffer:
	- Load BER-TLV buffer into a linked list data structured.
bertlvAddTag:
	- Add a strucured tag object into  BER-TLV List
bertlvDeleteTag
	- Exclude a specific tag os list (last parameter specify with tag occurance must be deleted). 
	  For example, number 1 must be used to exclude fist find of a specific tag, number 2 to exclude the second find,

Fetch Operation:

bertlvFetchInit:
	- Reset internal index to top of tree tag, used together with bertlvGetTag.
bertlvGetTag:
	- Retrive one by one tags from BER-TLV Tree into a structured data object
bertlvFindTag:
	- Retrive a specific tag from BER-TLV Tree into a structured data object,(last parameter specify with tag occurance must be finded).
          For example, nNumber 1 must be used to find fist occurency or 2 to find second occurancy.
berltvGetElementsNum:
	- Retrive number of elements presents on BER-TLV Tree data list.
bertlvCalcBufferToEncodeSize
	- Return necessary buffer lengh size to retrive encoded BER-TLV Buffer, used together with bertlvGetEncodedTagsBuffer.
bertlvGetEncodedTagsBuffer:
	- Encode BER-TLVs data list into a buffer.

Limitations: bertlvlib.so were designed to work with TAG up to 4 Bytes represantation and 4 bytes datalenght size.

EMV Book 3 v4.3

Updated on EMV Book 3 v4.3 Although advise against, use of private tags started with 'FF' are allowed , so only BYTES zeros (0x00) before, between or after tag datas will be ignored.

enter image description here

BackLog

  • Creat Functions to allow include primitive tag into specific constructed tag. (Workaround, second handle can be used: Forme new construted tag, include primitives tag, retrive encodade buffer to load on list of fist handle instance.
  • Perform SAST analise.
  • Schedule test on quality assurance team.
Similar Resources

Integrate PhysFS with raylib, allowing to load images, audio and fonts from data archives.

raylib-physfs Integrate the virtual file system PhysicsFS with raylib, allowing to load images, audio, and fonts from data archives. Features Load the

Oct 3, 2022

BlowBeef is a tool for analyzing WMI data.

Blowbeef BlowBeef is a tool for analyzing WMI data. Usage BlowBeef is a tool for analyzing WMI data.

Sep 2, 2022

Read Non-Rectangular Text Data

Read Non-Rectangular Text Data

meltr The goal of ‘meltr’ is to provide a fast and friendly way to read non-rectangular data (like ragged forms of ‘csv’, ‘tsv’, and ‘fwf’). Standard

Nov 9, 2022

The goal of arrowvctrs is to wrap the Arrow Data C API and Arrow Stream C API to provide lightweight Arrow support for R packages

The goal of arrowvctrs is to wrap the Arrow Data C API and Arrow Stream C API to provide lightweight Arrow support for R packages to consume and produce streams of data in Arrow format. Right now it’s just a fun way for me to learn about Arrow!

Aug 5, 2022

A combined suite of utilities for manipulating binary data files.

BinaryTools A combined suite of utilities for manipulating binary data files. It was developed for use on Windows but might compile on other systems.

Oct 1, 2022

Isocline is a pure C library that can be used as an alternative to the GNU readline library

Isocline is a pure C library that can be used as an alternative to the GNU readline library

Isocline: a portable readline alternative. Isocline is a pure C library that can be used as an alternative to the GNU readline library (latest release

Nov 10, 2022

A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename.

whereami A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename. usag

Sep 24, 2022

Command-line arguments parsing library.

argparse argparse - A command line arguments parsing library in C (compatible with C++). Description This module is inspired by parse-options.c (git)

Nov 19, 2022

A cross platform C99 library to get cpu features at runtime.

cpu_features A cross-platform C library to retrieve CPU features (such as available instructions) at runtime. Table of Contents Design Rationale Code

Nov 19, 2022
JSFuck obfuscator written in ANSI C.

jsfuck.h JSFuck obfuscator written in ANSI C. For more info/context, visit www.jsfuck.com. Tested on MinGW (Windows) and GCC (Linux, Ubuntu). Build To

Sep 9, 2022
C++ NIF library for the Gamebryo/NetImmerse File Format

nifly C++ NIF library for the Gamebryo/NetImmerse File Format. Created with a clean-room design. Features Reading and writing NIF files (Gamebryo/NetI

Oct 2, 2022
code (written in C) to check day by entering Date in DD/MM/YYYY format

Minimal Calendar Last Updated : Oct. 26, 2021 This code(written in C) can be used to know the day of the entered date in DD/MM/YYYY format. This c

Oct 29, 2021
A TreeSitter parser for the Neorg File Format

NFF TreeSitter Parser A TreeSitter grammar for Neorg. Available Commands Command Result yarn installs needed dependencies (only do if you don't have t

Nov 9, 2022
A ring buffer designed to work with embedded devices, does not use heap allocations.
A ring buffer designed to work with embedded devices, does not use heap allocations.

Embedded Ring Buffer This is a header only ring buffer that is designed to work on embedded devices, it is able to handle non-blocking ISR spooling

Aug 9, 2022
This data is a sample data created for a Qiita article and a YouTube commentary.
This data is a sample data created for a Qiita article and a YouTube commentary.

NiagaraSample UE4 4.27.1 English This data is a sample data created for a Qiita article and a YouTube commentary. Here is some sample data that may be

Jun 15, 2022
A C library for parsing/normalizing street addresses around the world. Powered by statistical NLP and open geo data.
A C library for parsing/normalizing street addresses around the world. Powered by statistical NLP and open geo data.

libpostal: international street address NLP libpostal is a C library for parsing/normalizing street addresses around the world using statistical NLP a

Nov 23, 2022
C++ header-only library for generic data validation.

C++ header-only library for generic data validation.

Nov 15, 2022
Open Data Description Language

Open Data Description Language This is the reference parser for the Open Data Description Language (OpenDDL), version 3.0. The official language speci

Nov 8, 2022
Example of transferring file data over BLE using an Arduino Nano Sense and WebBLE

BLE File Transfer Example of transferring file data over BLE to an Arduino Nano Sense using WebBLE. Overview This is an example of how to use Bluetoot

Nov 4, 2022