使用java的ASN.1文件解析器/编译器

时间:2022-10-29 13:47:01

I am new to ASN.1 syntax and what i want is a ASN.1 compiler which parse the ASN.1 syntax and generate .java files. I googled for the same thing and got few solution but thous are not working well (Or they are capable of parsing very specific syntax and generate java files)

我是ASN.1语法的新手,我想要的是一个ASN.1编译器,它解析ASN.1语法并生成.java文件。我google了同样的事情并得到了一些解决方案,但是它们运行不正常(或者他们能够解析非常具体的语法并生成java文件)

  1. This link is working for some extent
  2. 此链接在某种程度上有效
  3. This link is capable of generating few files
  4. 此链接能够生成少量文件

Is there any source which parse advanced syntax Or all the content of ASN.1 and generate java files..?

是否有任何源解析高级语法或ASN.1的所有内容并生成java文件..?

How i suspect above links are working for some extent ?

我怀疑上面的链接是否在某种程度上起作用?

First i checked whether ASN.1 file is proper / valid by using ASN.1 play ground ( OSS Nokalva), then by using above source code i have parsed ASN.1 file and able to generate around 195 files.

首先我通过使用ASN.1播放地(OSS Nokalva)检查ASN.1文件是否正确/有效,然后通过使用上面的源代码我已经解析了ASN.1文件并且能够生成大约195个文件。

But the generated files are having some error like few of them didn't contain encode / decode method, some java classes are extended with other supper classes which are not generated at all (Even though ASN.1 file contain a description about thous supper classes).

但是生成的文件有一些错误,例如它们中的一些不包含编码/解码方法,一些java类扩展了其他没有生成的超类(尽管ASN.1文件包含关于thous supper类的描述) )。

So, by using same ASN.1 file and with the help of this site i have generated C files then it generated around 456 files [228 are header files and 228 are .c files] which contain all the non generated supper class files of java with proper encode / decode method with value can be set using constructors.

因此,通过使用相同的ASN.1文件并在此站点的帮助下生成了C文件,然后它生成了大约456个文件[228是头文件,228是.c文件],其中包含所有未生成的java的超类文件可以使用构造函数设置具有值的适当编码/解码方法。

i have gone through Bouncy Castle but i didn't find any clue about parsing ASN.1 file to generate java files.

我已经通过Bouncy Castle,但我没有找到任何关于解析ASN.1文件以生成java文件的线索。

But after gone through few links i felt Bouncy Castle is a algorithm based java code to encode / decode the string values and more specifically Bouncy castle is a API which strongly support for encryption / decryption for security purpose like creating SSL and it also include ASN.1 syntax support, it provide high end Interfaces / Classes like BER/PER/DER etc. parser but we need to write the supporting classes by referring ASN.1 syntax and there is no proper information / clue / white paper. so far i have this link to work with Bouncy Castle (If i am wrong pleas make me understand).

但经过几个链接之后,我觉得Bouncy Castle是一个基于算法的java代码来编码/解码字符串值,更具体地说,Bouncy castle是一个API,它强烈支持加密/解密,出于安全目的,如创建SSL,它还包括ASN。 1语法支持,它提供高端接口/类,如BER / PER / DER等解析器,但我们需要通过引用ASN.1语法编写支持类,没有适当的信息/线索/白皮书。到目前为止,我有这个链接与Bouncy城​​堡合作(如果我错了请求让我明白)。

Why i want to generate java files..?

为什么我要生成java文件..?

I already have Encoded files (CDRs) which encoded using ASN.1 file syntax, so if i get java files then i can decode thous files to get required information.

我已经有使用ASN.1文件语法编码的编码文件(CDR),所以如果我得到java文件,那么我可以解码thous文件以获取所需信息。

____________________________Or____________________________________

____________________________要么____________________________________

How can i write my own JAVA Encode / Decode methods by referring ASN.1 syntax file and with the help of Bouncy Castle API.

如何通过引用ASN.1语法文件并在Bouncy Castle API的帮助下编写自己的JAVA编码/解码方法。

So far i have not seen any open source example / code snippets which demonstrate the way of mapping / writing / simple example to create encode or decode methods in java using ASN.1 syntax file.

到目前为止,我还没有看到任何开源示例/代码片段,它们演示了使用ASN.1语法文件在java中创建编码或解码方法的映射/编写/简单示例的方法。

any help will be appreciated, Thanks.

任何帮助将不胜感激,谢谢。

1 个解决方案

#1


0  

For the above question i have answered in following link http://*.com/questions/35924703/bouncy-castle-example-for-encoding-cdr/36496740#36496740

对于上述问题,我已在以下链接中回答http://*.com/questions/35924703/bouncy-castle-example-for-encoding-cdr/36496740#36496740

#1


0  

For the above question i have answered in following link http://*.com/questions/35924703/bouncy-castle-example-for-encoding-cdr/36496740#36496740

对于上述问题,我已在以下链接中回答http://*.com/questions/35924703/bouncy-castle-example-for-encoding-cdr/36496740#36496740