> Hi all. Ok I need to set up a cipher and certificate. But I've a little > question: How to make a X509 certificate? What is the right way to build > a X509 certificate in C? > For example: > > X509 *newx509 = NULL; > newx509 = X509_new(); > assert(newx509 != NULL); > > and then? How to set attribbutes, name, etc..?
Call X509_new to allocate a new X509 certificate structure. (X509_new) Call X509_set_version to set the version to the number 2, which means version 3. (X509_set_version) Set the serial number, issuer name, subject name, and validity interval. (X509_set_issuer_name, X509_set_subject_name, x509_set_notBefore, X509_set_notAfter) Set the public key to the subject's public key. (X509_set_pubkey) Add any basic contraints, key usage, and the like. (X509V3_EXT_conf_nid, X509_add_ext) Then, if desired: Sign the certificate. (X509_sign) Then do whatever you want with the certificate. When you're done: Free the certificate structure. (X509_free) DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]