Sorry, I made a mistake about the dump stack. The
stack was due to a null pointer call in RSA_size and
RSA does not do any pointer validation check. 
    Now I have two questions:
    1.Why does RSA_size core dumps with a RSA_new()
pointer? A return value of 0 is more resonable.
    2. It seems that in my program
PEM_read_bio_RSAPrivateKey(in,NULL,NULL,NULL) can only
deals with keyfiles without RSA pass phase protection,
and return NULL for keyfiles that do have pass phase.
But in apps/rsa.c, the same code can do with both!
Bellow is the error I printed out after the function
call:
21618:error:0906B072:PEM
routines:PEM_get_EVP_CIPHER_INFO:unsupported
encryption:pem_lib.c:454:

#############my program##################3

RSA *rsa=NULL;
BIO * in,*out;
char* keyfile="key.pem";

in=BIO_new(BIO_s_file());
if (BIO_read_filename(in,keyfile) <= 0)
                        {
                        printf("read keyfile name into
BIO* in error, exiting...\n");
                        ERR_print_errors_fp(stderr);
                        exit(1);
                        }
if (in == NULL)
                {
                printf("in==NULL exiting .....");
                exit(1);
                }
rsa=PEM_read_bio_RSAPrivateKey(in,NULL,NULL,NULL);
if(rsa==NULL)
                {
                ERR_print_errors_fp(stderr);
                exit(1);
                }

.....


Anyone can help me?

Hazel

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to