hai everyone,
i am new to ssl, i have spent some amount of time trying to read openssl,
documentaion(though not yet complete). i am writing a simple program to read
information from a PEM file.
i am getting the error
** too few arguments to function `PEM_read_X509' ***
i looked into the documentaion of ssleay(though obsolete), and found that the function
call is correct.
can u tell me where the error is?
******************************************************
#define CA_FILE "ssl/CA/cacert.pem"
#define CA_PATH "ssl/CA"
#define KEY_FILE "ssl/private/my.key"
#define CERT_FILE "ssl/cert/my.cert"
ca_path=CA_PATH;
ca_file=CA_FILE;
key_file=KEY_FILE;
cert_file=CERT_FILE;
SSL_load_error_strings();
SSLeay_add_ssl_algorithms();
ctx=(SSL_CTX *) SSL_CTX_new(SSLv23_server_method());
if (ctx == (SSL_CTX *) NULL)
fatalError("Unable to create new SSL CTX\n");
if(!SSL_CTX_load_verify_locations(ctx,ca_file,ca_path)) (void)
fprintf(stderr,"Failed in SSL_CTX_load_verify_locations()!\n");
err=SSL_CTX_use_RSAPrivateKey_file(ctx, key_file, SSL_FILETYPE_PEM);
if (err == -1)
{
ERR_print_errors_fp(stderr);
exit(1);
}
err=SSL_CTX_use_certificate_file(ctx,
cert_file,
SSL_FILETYPE_PEM);
if (err == -1)
{
ERR_print_errors_fp(stderr);
exit(1);
}
/*
** read the ca certificate and save the issuer string
*/
ca_fp=fopen(ca_file,"r");
if (ca_fp == (FILE *) NULL)
(void) fprintf(stderr,"Failed to open Trusted CA certificate file: %s\n",
ca_file);
ca_cert=NULL;
ca_cert=X509_new();
if (!PEM_read_X509(ca_fp,&ca_cert,NULL))
(void) fprintf(stderr,"Error reading trusted CA certificate fie:
%s\n",ca_file);
X509_NAME_oneline(X509_get_issuer_name(ca_cert),issuer,256);
if (issuer == (char *) NULL)
(void) fprintf(stderr,"No issuer for trusted CA certificate file!\n");
if (ca_cert != NULL)
X509_free(ca_cert);
(void) fclose(ca_fp);
**************************************************
_________________________________________________________
For Rs. 2,000,000 worth of Aptech scholarships click below
http://events.rediff.com/aptechsch/scholarship.htm
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]