Skip to content

PayEx/ber-tlv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maven Build Status CircleCI

BER-TLV parser and builder

BerTlv is a java library for parsing and building BER TLV encoded data.

Features

  • supported types: amount, date, time, text, BCD, bytes
  • thread safe (provides immutable container BerTlv)
  • production ready (uses in several projects)
  • lightweight (no external dependencies)

Setup with dependency managers

Maven

<dependency>
  <groupId>com.payneteasy</groupId>
  <artifactId>ber-tlv</artifactId>
  <version>$VERSION</version>
</dependency>

Gradle

compile 'com.payneteasy:ber-tlv:$VERSION'

How to parse

byte[] bytes = HexUtil.parseHex("50045649534157131000023100000033D44122011003400000481F");

BerTlvParser parser = new BerTlvParser(LOG);
BerTlvs tlvs = parser.parse(bytes, 0, bytes.length);
  
BerTlvLogger.log("    ", tlvs, LOG);

How to build

byte[] bytes =  new BerTlvBuilder()
                .addHex(new BerTag(0x50), "56495341")
                .addHex(new BerTag(0x57), "1000023100000033D44122011003400000481F")
                .buildArray();

License

The BerTlv framework is licensed under the Apache License 2.0

Packages

No packages published

Languages

  • Java 100.0%