Hello, I created a private key with password. But I can not read that key again. And the callback function "pass_cb" was not called at all.
FILE *privateKeyFilePW; RSA *keyReading=NULL; privateKeyFilePW =fopen("PrivatekeyPW.pem", "w"); PEM_write_RSAPrivateKey(privateKeyFilePW, r,EVP_des_ede3_cbc(),NULL, 0, NULL, NULL); fclose(privateKeyFilePW); keyReading=RSA_new(); privateKeyFilePW =fopen("PrivatekeyPW.pem", "r"); PEM_read_RSAPrivateKey(privateKeyFilePW, &keyReading, pass_cb, "My Private Key"); fclose(privateKeyFilePW); The callback function. int pass_cb(char *buf, int size, int rwflag, void *u) { int len; char *tmp; /* We'd probably do something else if 'rwflag' is 1 */ printf("Enter pass phrase for \"%s\"\n", u); /* get pass phrase, length 'len' into 'tmp' */ tmp = "hello"; len = strlen(tmp); if (len <= 0) return 0; /* if too long, truncate */ if (len > size) len = size; memcpy(buf, tmp, len); return len; } _________________________________________________________________ Explore the seven wonders of the world http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE