Actually I'm working on a small wrapper for the X509 object.

I need all the following:

   1. Version: got this from X509_get_version(cert)
   2. Serial number: got this from
   ASN1_INTEGER_get(X509_get_serialNumber(cert))
   3. Signature Algorithm as a string: got this from
   OBJ_nid2ln(X509_get_signature_type(cert))
   4. Signature alg parameters as a byte buffer: will EVP_PKEY_print_param()
   help?
   5. Issuer name: Used X509_get_issuer_name to get a X509_NAME and then
   printed it in ONELINE format to a mem bio.
   6. Subject name: Similar to 5.
   7. Public key: I did memcpy(destBuffer, pubkey->pkey,
   EVP_PKEY_size(pubkey)).
   8. Not before/after: did the following, where ptime is my internal
   structure, hope it's correct.
   1.  char *time = (char *) malloc(asn1time->length+1);
       memcpy(time, asn1time->data, asn1time->length);
        time[asn1time->length] = '\0';
        sscanf(time, "%2d%2d%2d%2d%2d%2dZ", &ptime->year, &ptime->month,
      &ptime->day, &ptime->hour, &ptime->minute, &ptime->second);
        free(time);
        ptime->millisecond = 0;

Am I doing all the right things? Or am I completely off the track?

On Mon, Jan 10, 2011 at 3:25 PM, Christian Hohnstaedt <
christ...@hohnstaedt.de> wrote:

> On Mon, Jan 10, 2011 at 02:32:35PM +0530, Karthik Ravikanti wrote:
> > I remember seeing a method to get the signature parameters as a buffer. I
> > can't find it now. :-(
>
> OBJ_nid2ln(OBJ_obj2nid(cert->sig_alg->algorithm))
> returns a pointer to the string representation of the signature algorithm
> like "sha1WithRSAEncryption"
>
>
> What else do you need ?
>
>
>        Christian
>
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           majord...@openssl.org
>

Reply via email to