0 length Ber TLV tag got drop when using BerTlvBuilder
See original GitHub issueHi, thanks for your great library. I’ve some issue with building nested BerTLV tag. The following is working as expected :
BerTlv tlv = new BerTlv(new BerTag(0x01),new byte[]{0x06});
BerTlv some = new BerTlvBuilder()
.addBytes(new BerTag(0xE3), new BerTlvBuilder().addBerTlv(tlv).buildArray())
.buildTlv();
which gives :
010106
E303010106
But when using 0 length BerTLV tag, the following is not working
BerTlv tlv = new BerTlv(new BerTag(0x01),new byte[]{});
BerTlv some = new BerTlvBuilder()
.addBytes(new BerTag(0xE3), new BerTlvBuilder().addBerTlv(tlv).buildArray())
.buildTlv();
I get :
0100
E300
But I’m expecting :
0100
E3020100
Thanks for your help
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Why BER-TLV "DF9A" tag is recognized as "invalid"?
I have problem with understanding why all the BER ...
Read more >com.payneteasy.tlv.BerTlvBuilder java code examples - Tabnine
public BerTlvBuilder add(BerTlvBuilder aBuilder) { byte[] array = aBuilder.buildArray(); System.arraycopy(array, 0, theBuffer, thePos, array.length); ...
Read more >PrimitiveBERTLV (Java Card API, Classic Edition)
Writes a primitive TLV representation to the specified byte array using as input a Primitive BER tag representation in a byte array and...
Read more >Basic Encoding Rules (BER) class for embedded system
Ber (uint8_t tag, unsigned short length=0, const uint8_t ... should get a crash if trying to free data allocated with new[] using delete...
Read more >com.payneteasy.tlv.BerTlvBuilder Maven / Gradle / Ivy
Search and download functionalities are using the official Maven repository. ... buffer, 0, buffer.length); } public BerTlvBuilder addBytes(BerTag aObject ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bertrandmartel Great. I’ve just release 1.0-8 version. It’ll be available in a hour once sonatype will promote it to maven-central.
I’ve got your point. I thought that you use BerTlvBuilder.buildArray() to create an array.
You are right BerTlvBuilder.buildTlv() returns wrong elements. It skips tags with an empty length.
I’ll fix it.