Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7946795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:15:06+00:00 2026-06-04T01:15:06+00:00

I have binary ASN.1 data objects I need to parse into my Java project.

  • 0

I have binary ASN.1 data objects I need to parse into my Java project. I just want the ASN.1 structure and data as it is parsed for example by the BER viewer:

ASN.1 structure as shown in BER viewer

The ASN.1 parser of BouncyCastle is not able to parse this structure (only returns application specific binary data type).

What ASN.1 library can I use to get such a result? Does anybody has sample code that demonstrates how to parse an ASN.1 object?

BTW: I also tried several free ASN.1 Java compilers but none is able to generate working Java code given may ASN.1 specification.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:15:07+00:00Added an answer on June 4, 2026 at 1:15 am

    I have to correct myself – it is possible to read out the data using ASN.1 parser included in BouncyCastle – however the process is not that simple.

    If you only want to print the data contained in an ASN.1 structure I recommend you to use the class org.bouncycastle.asn1.util.ASN1Dump. It can be used by the following simple code snippet:

    ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(data));
    ASN1Primitive obj = bIn.readObject();
    System.out.println(ASN1Dump.dumpAsString(obj));
    

    It prints the structure but not the data – but by copying the ASN1Dump into an own class and modifying it to print out for example OCTET_STRINGS this can be done easily.

    Additionally the code in ASN1Dump demonstrates to parse ASN.1 structures. For the example the data used in my question can be parsed one level deeper using the following code:

    DERApplicationSpecific app = (DERApplicationSpecific) obj;
    ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);
    Enumeration secEnum = seq.getObjects();
    while (secEnum.hasMoreElements()) {
        ASN1Primitive seqObj = (ASN1Primitive) secEnum.nextElement();
        System.out.println(seqObj);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have const binary data that I need insert to buffer for example char
I am not sure why List as a general data structure should have binary
I have some binary data produced as base-256 bytestrings in Python (2.x). I need
I have binary data in a file that I can read into a byte
I have binary images and I want to convert them into a different type
If you have binary data that you need to encode, what encoding scheme do
I have some binary data which contains a bunch of functions and want to
I have a binary data file and need to retrieve some data from it.
I have binary data in my database that I'll have to convert to bitmap
I have binary codes as 10111 , 100011 , 11101111 etc. now what data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.