Subject string to X509_NAME

2004-07-29 Thread Pablo J Royo
Hello:

I have a subject string in its common format:

C=XX /O=xxx /OU=yy /CN=z...etc

and I´d like to create a X509_NAME object with it, in order to handle its
different fields (X509_NAME_ENTRY) correctly.
Is there any function in OpenSSL X509 interface to do this (as easy as
possible)?

Thanks

__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


Re: Subject string to X509_NAME

2004-07-29 Thread Dr. Stephen Henson
On Thu, Jul 29, 2004, Pablo J Royo wrote:

 Hello:
 
 I have a subject string in its common format:
 
 C=XX /O=xxx /OU=yy /CN=z...etc
 
 and I´d like to create a X509_NAME object with it, in order to handle its
 different fields (X509_NAME_ENTRY) correctly.
 Is there any function in OpenSSL X509 interface to do this (as easy as
 possible)?
 

There isn't an OpenSSL library function to do this but the openssl utility has
some code that will parse things in that format.

There are some things to be careful of such as how to handle embedded '/'
within fields.

If you can split that into a set of name value strings (CN, XX) (O,
) you can then call the standard X509_NAME_add_entry_by_txt() call. 

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]