Search code examples
c++compilationdigital-certificateasn.1rfc

Compiling complex (with many references) ASN schema - Certificate Request Format ( RFC4211)


What I want to do is have my own routine (CPP preffered) that can create a Certificate Request Message as in RFC4211.

I understand that the way of doing this is first of all getting an ASN module description, then compile it to get the code that I can use to then create an object of the type that I need ( In this case a CertReqMessage ). Then I can encode this using BER or XER or whatever ...

So I set up first to gather all the needed ASN Modules and the list contains a lot of RFCS - RFC4211,RFC5280,RFC5652,RFC5755 and perhaps another one that I am missing right now. I extracted them from the RFCs and then tried to compile them but I am unable to compile all the files (I use this compiler http://lionet.info/asn1c/compiler.html ). The "lowest level" RFcs (that to not import from others ) work , but as I add other RFCs to the compilation list,at some point ( usually when adding the last one ) , I get a message that one or two of the external modules are not found, even though they are in the list of args as files to compile. I also get messages about expression clashes between the ASN modules ...

I tried to put all the modules into one file and used this compiler: http://asn1-playground.oss.com/ and it appeared to work (with some warnings), but I cannot get the code using this online one .

I am not sure what is wrong - is there a problem with this asn1c compiler (v0.9.27), or are there some steps I must do which I did not ? Do I have to manually correct all these clashes by myself and the imports or what?

Or is there some better compiler which I can use?

Thanks for any help!


Solution

  • If anyone is interested or has the same kind of problem -

    I found a "solution" by using BouncyCastle API (1.49-1.52) in java. The library includes specific implementations of the CMS container and CRMF and so on which I needed, and I was able to find some (though not super detailed) example applications from which I could build the messages that I needed.

    If you need this in C#, keep in mind that the C# bouncycastle implementation is not maintained as well as the java ones and there is a difference in the API. There are some tools which allow you to "port" the library from java to C#, so you have the latest up to date version.

    I still have not been able to fully compile the whole schema by myself though ... just found this way around it .

    Maybe the answer can help somebody else in need.