Hello friends, Does openssl supports PKCS#1 v2.1 ?? Does it provide the API's??
Thanks in advance Santosh -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Kaushalye Kapuruge Sent: Thursday, November 30, 2006 5:34 PM To: [email protected] Subject: Re: get CA name from user certificate Have you tried to use the code without modifications using the same certificate? If you need to load the X509 certificate use following code. Moreover you may find useful information to call these PEM routines in the manual page(%man PEM). Cheers, Kaushalye <Code for loading certificate> BIO *in; if ((in=BIO_new_file(filename,"r")) == NULL) { printf("Error reading the file\n"); return -1; } /*Read certificate*/ PEM_read_bio_X509(in, &cert,NULL,NULL); if(!cert) { printf("Error creating the certificate\n"); return -1; } BIO_reset(in); BIO_free(in); </Code for loading certificate> imin macho wrote: > 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] > <mailto:[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] > <mailto:[email protected]> > Automated List Manager > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [email protected] Automated List Manager [EMAIL PROTECTED] ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]
