Closed gleclezio closed 6 years ago
actually the code you modified was automatically generated using antlr. So instead of modifying the java code directly it is better to change the antlr code located in jasn1/projects/jasn1-compiler/antlr/ans1.g and then generate the classes again.
Anyways, parsing of ASN.1 values is not well supported by this library since it was never really the goal of the project.
Why I didn't do that before... It was so easier. Thanks a lot
The asn1.g has been modified by replacing '+' by '*':
B_STRING : SINGLE_QUOTE (BDIG)+ SINGLE_QUOTE 'B' ;
into
B_STRING : SINGLE_QUOTE (BDIG)* SINGLE_QUOTE 'B' ;
and
H_STRING : SINGLE_QUOTE (HDIG)+ SINGLE_QUOTE 'H' ;
into
H_STRING : SINGLE_QUOTE (HDIG)* SINGLE_QUOTE 'H' ;
Hello and thank you for your help, My company would like to use and commercialize my soft based on jAsn1. Do you allow us to do that ?
Regards, Gregory
2017-10-20 14:11 GMT+02:00 sfeuerhahn notifications@github.com:
actually the code you modified was automatically generated using antlr. So instead of modifying the java code directly it is better to change the antlr code located in jasn1/projects/jasn1-compiler/antlr/ans1.g and then generate the classes again.
Anyways, parsing of ASN.1 values is not well supported by this library since it was never really the goal of the project.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/openmuc/jasn1/issues/4#issuecomment-338189065, or mute the thread https://github.com/notifications/unsubscribe-auth/AfWuSHtVlQeRJfHKJshbQ14HpEoiCyCRks5suI4JgaJpZM4P_czO .
I'm using the jAsn1 library to convert ASN1 definition into java classes and then ASN1 values files (representation of the ASN1 definition with real values written in ASN1) to instantiate dynamically the java objects. During the parsing of the ASN1 values files with jAsn1, I found, if I'm not wrong, that the empty octet string (ie in ASN1: varName ''H ) was not correctly parsed in the ASNLexer class.
Example of definition:
With corresponding Value used:
Error reported by jAsn1:
To correct this, I modified the nextToken() method by adding in the default case of the switch a new else if :
and I modified the mH_STRING method by modifying the
if (_cnt73 >= 1)
intoif (_cnt73 >= 0)
.Would it be possible that you confirm me that these changes make sens for you ?