kapuruge,

thanks a lot for helping. i tried the source code you gave me and added
some.

here's what I did:
AnsiString FName = ExtractFilePath(Application->ExeName) + "temp.crt";
X509 *xca=NULL;
char *xca2=NULL;
xca2 = FName.c_str();
xca = ReadCertificate(xca2);

BIO *out;
   unsigned char *issuer, *result;
   int n;
   out = BIO_new(BIO_s_mem());
   X509_NAME_print_ex(out, X509_get_issuer_name(xca), 0,0);
   n = BIO_get_mem_data(out, &issuer);
   result = (char *) malloc (n+1);
   result[n]='\0';
   memcpy(result,issuer,n);
   BIO_free(out);
   out = NULL;
   AnsiString issuerTemp(reinterpret_cast<char *>(result));
  ShowMessage(issuerTemp);

I tried displaying the issuer using the ShowMessage, but i returned an empty
message box. what did i do wrong? thanks a lot

On 11/29/06, Kaushalye Kapuruge <[EMAIL PROTECTED]> wrote:

imin macho wrote:
> hi
>
> i'm really new to this openSSL thingy. is there any function we can
> use to read/extract CA's name from client certificate? thank you.
Macho,
You may use following code. Here cert is X509*.
Cheers,
Kaushalye

    BIO *out;
    unsigned char *issuer, *result;
    int n;
    out = BIO_new(BIO_s_mem());
    X509_NAME_print_ex(out, X509_get_issuer_name(cert), 0,0);
    n = BIO_get_mem_data(out, &issuer);
    result = (char *) malloc (n+1);
    result[n]='\0';
    memcpy(result,issuer,n);
    printf("Issuer : %s\n",result);
    BIO_free(out);
    out = NULL;


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

Reply via email to