Questions tagged [ber]

The Basic Encoding Rules were the original rules laid out by the ASN.1 standard for encoding abstract information into a concrete data stream. The rules, collectively referred to as a transfer syntax in ASN.1 parlance, specify the exact octet sequences which are used to encode a given data item.

Definition:

The Basic Encoding Rules (BER) are the rules that were initiated from the ASN.1 definition for encoding abstract information into a concrete data stream.

The rules, known as a transfer syntax in the ASN.1 parlance, denote the octet sequences which are used to encode a specific piece of data.

Important Links:

43 questions
11
votes
1 answer

ASN.1 SEQUENCE (OF) real tag value

I am finding a lot of contradicting information regarding the tag value for the SEQUENCE (OF) ASN.1 datatype: Wikipedia claims it is both 0x10 and 0x30: http://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One ->…
Krassi
  • 2,158
  • 3
  • 21
  • 29
7
votes
1 answer

Parsing PDOL for GET PROCESSING OPTIONS command in EMV transaction

I am trying to build a correctly formatted GET PROCESSING OPTIONS command to be sent to a contactless EMV card. This post has been very helpful but I just need to know a little more detail. When parsing the PDOL, is it safe to assume that each tag…
Scott Condron
  • 1,195
  • 9
  • 17
5
votes
2 answers

Confused about BER (Basic Encoding Rules)

I'm trying to study and understand BER (Basic Encoding Rules). I've been using the website http://asn1-playground.oss.com/ to experiment with different ASN.1 objects and encoding them using BER. However, even the simplest encodings seem to confuse…
Channel72
  • 22,459
  • 30
  • 97
  • 168
4
votes
2 answers

Opensource Java ASN.1 decoder that work with automatic tags

I'm new to working with ASN.1 encoded streams and I'm having a hard time finding a free class compiler and decoder, preferably for Java. I have an encoded hex string: String test("30820274800200a2810105820410300c3d830401bb0afc84... Here is an…
user1978816
  • 782
  • 1
  • 7
  • 17
3
votes
2 answers

When reading BERTLV, when do you stop?

I have the following BERTLV: 61394F0BA00000030800001001234579074F05A000012345500E49442D4F6E65205049562042494F5F50107777772E6F626572746875722E636F6D7F66080202800002028000 I'm trying to parse this in a recursive way, so I am treating the first part as…
codenamezero
  • 2,093
  • 23
  • 47
3
votes
1 answer

Decode SNMP PDUs - Where to Start?

Hello my first ever question on here, in need of bit of guidance. I'm working on a packet sniffer mainly to decode SNMP PDUs, however I am not entirely sure where to go with it. Simply put my packet sniffer can extract information from packets…
Michael01
  • 33
  • 1
  • 1
  • 5
2
votes
1 answer

Additional Octet String in Bouncycastle signed data message

I am creating a CSCA Master list signed data but after successful creation of it, I see two Octet String instead of one in signed message. Please check the source code and output files CMS using BC // load master list signer key …
2
votes
1 answer

How do you encode a post-1994 ASN.1 EXTERNAL type?

Background: Prior to 1994, EXTERNAL was defined like so (with automatic and explicit tagging): EXTERNAL ::= [UNIVERSAL 8] IMPLICIT SEQUENCE { direct-reference OBJECT IDENTIFIER OPTIONAL, indirect-reference INTEGER OPTIONAL, …
Jonathan Wilbur
  • 685
  • 3
  • 15
2
votes
1 answer

How do you escape double null octets within an octet string encoded with indefinite length in BER?

I am trying to write a Basic Encoding Rules codec in D, and I would like the ability to encode data with indefinite length encoding, in which the length byte is set to 0x80 and the end of the value bytes is demarcated with a double null 0x00 0x00…
Jonathan Wilbur
  • 685
  • 3
  • 15
2
votes
1 answer

Interpreting ASN.1 indefinite-lenght encoding with multiple encapsulated octet-strings

I have a BER structure like this... $ openssl asn1parse -inform der -in test.der -i -dump ????:d=4 hl=2 l=inf cons: cont [ 0 ] ????:d=5 hl=3 l= 240 prim: OCTET STRING 0000 - AABBCCDD ????:d=5 hl=2 l= 8 prim: OCTET…
duesee
  • 101
  • 1
  • 9
2
votes
1 answer

Can I specify an Application or Context-Specific tag with C# BerConverter.Encode()?

.NET's System.DirectoryServices.Protocols assembly specifies a light-weight ASN.1 BER encoder, but the documentation is not great: BerConverter. You call it by specifying a format string and a list of objects to encode. INTEGERs can be encoded with…
petrsnd
  • 5,736
  • 5
  • 23
  • 32
2
votes
1 answer

Reading encode asn file manually

how to read encode asn file manually? what is the Tag-Length-Value, Is there a good tutorial ? In the following examples i read each of them but does not clean for me, can anyone help to read each of them : 30 82 02 10 04 01 56 … (for many more…
1
vote
0 answers

PKCS#7 CMS - Message digest calculation process

i'm studying RFC 5652 in order to know exactly how to encode/decode PKCS#7 ASN.1 data. I don't understand how one can create a signature when the field "signedAttrs" is present: The result of the message digest calculation process depends…
Lazarus
  • 125
  • 11
1
vote
2 answers

Encoding of implicit and explicit tags in ASN.1

I am trying to understand how IMPLICIT and EXPLICIT tags are actually encoded in the DER binary form. The basic examples are clear. Plain integer, x INTEGER ::= 5 is encoded as a TLV triple 02 01 05. In x [2] IMPLICIT INTEGER ::= 5 implicit tag 82…
klk206
  • 382
  • 1
  • 6
1
vote
2 answers

EMV TLV parsing sometimes does not display constructed values (childs)

My method parseTLV() sometimes does not properly decend into constructed values (child TLVs). I use a filter ((tag & 0x20)! = 0) to detect constructed values, but sometimes it doesn't work as expected. For…
Ihdina
  • 452
  • 3
  • 12
1
2 3