I have got the reason. It is because that I haven't call SSLeay_add_all_algorithms(),so the cipher can't run well. thanks all!
--- "<[EMAIL PROTECTED]>" wrote -- > > I want to generate a rsa encrypted private key file using openssl > commands,and then use the privkey file to retrieve the private key in > my c language program. > I tried the cmd: > 1)openssl genrsa ¨Cpassout stdin -out key.pem > and then input the -passout specific parm"12345",so got the key.pem > file.But the out file seems not a encrypted priv key file,I am puzzling > what is the usage of my input "12345"? > so I tried again: > 2)openssl genrsa -des -out key2.pem > It prompted me to "Enter PEM pass phrase:",I gived "12345",and it > seems worked. Then I used the file key2.pem in my program as follows: > > char * passin = "12345"; > EVP_PKEY *pkey = NULL; > pkey=PEM_read_bio_PrivateKey(in,pkey,0,passin);//in is key2.pemfile bio > > but it dosen't work at all, pkey is NULL in the end. > How can I get the right private key from my key2.pem? > > > best regards! > xue yuan > > > > ________________ > USTC Alumni Email System, http://mail.ustc.edu, FREE Signup. > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List [EMAIL PROTECTED] > Automated List Manager [EMAIL PROTECTED] ________________ USTC Alumni Email System, http://mail.ustc.edu, FREE Signup. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]