0

Is there any API/C program to convert Distinguished name(DN) in ASCII String format to DER encoded ASN.1 DN ?

For example I want to encode this string "C=CH, O=Texas, CN=iss" in ASN.1 DER format, in order to send in a packet.

Please help me out on this.

1 Answers1

0

This is part of the X.500 series of recommendations in ITU-T. I assume you already have the ASN.1 specification which includes this Distinguished Name. If you don't, you can get it from http://www.itu.int/rec/T-REC-X.500/en. You then need an ASN.1 Toolkit to make this easy. A great list of ASN.1 Tools (some free, some commercial) can be found at http://www.itu.int/ITU-T/asn1/links/index.htm.

You feed the ASN.1 specification (from X.500) to the ASN.1 Compiler which will generate an encoder/decoder in your target language (sounds like yours is C) to convert your information from a C structure into a DER binary stream and vice versa.

An excellent place to play with the ASN.1 while you are trying to figure out exactly what you need is http://asn1-playground.oss.com which is an online ASN.1 compiler and encoder/decoder you can use to see what encodings your ASN.1 specifications will produce given your values.

Paul Thorpe
  • 1,930
  • 17
  • 23