I am using 2 ASN.1 files pkcs-1.asn and pkcs-8.asn from the PKCS standards which both define the same modules. Can I specify the same package name for both? For example, suppose the package name is com.name.pkcs . I compiled these 2 files separately and I got two similar files in the same package.

This question applies to PKCS and other standards as well. You can put class files in a common package by compiling the pkcs-1 and pkcs-8 together:

asn1pjav -root -o com.name.pkcs pkcs-1.asn pkcs-8.asn

Note the use of the -root option to instruct the ASN.1 compiler that all input modules are root modules. Otherwise, the compiler will treat PKCS-1 as a helper module for PKCS-8 and since PKCS-8 does not import any types from the PKCS-1, it will not generate any PKCS-1 classes. Alternatively, you can specify the set of root modules via the OSS.ROOT standard directive. See the OSS ASN.1 Tools for Java Reference Manuals for more information about the OSS.ROOT directive.


The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.



Contact Support
contact Our office hours
24 hours/day, 7 days/week

  • Phone: 1-888-OSS-2761 (USA and Canada)
  • Phone: 1-732-302-9669 (International)
  • Fax: 1-732-302-0023
  • Email: support@oss.com
Free Trial
download

Test drive the OSS Nokalva ASN.1, 4G and XML Tools now! Your trial includes complete software, documentation, sample programs, free 24x7 technical support and more.




Learn ASN.1
Learn ASN.1

Our expert personnel can help you learn ASN.1!

We offer 4-day ASN.1 courses at our headquarters or your premises.