int _tmain(int argc, _TCHAR* argv[])
{
X509 *x;
EVP_PKEY *pkey;
PKCS12 *p12;
STACK_OF(X509) *ca=NULL;
FILE *fp;
int code;
CRYPTO_malloc_init();
SSL_library_init();
SSL_load_error_strings();
ERR_load_BIO_strings();
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
x = X509_new();
code = fopen_s(&fp,PRIVATE_CERTIFICATE, "rb");
//fp = fopen(PRIVATE_CERTIFICATE, "rb");
p12 = d2i_PKCS12_fp(fp, NULL);
fclose(fp);
if (!PKCS12_parse(p12, KEYPASS, &pkey, &x, &ca)) {
printf(" Error while parsing\n");
}
PKCS12_free(p12);
code = fopen_s(&fp,TEMP_STORE_CERTIFICATE, "w");
PEM_write_X509(fp, x);
fclose(fp);
//RSA Private Certificate
fp = fopen(TEMP_STORE_KEY_CERTIFICATE,"w");
PEM_write_PrivateKey(fp, pkey, NULL, NULL, 0, NULL, NULL);
fclose(fp);
return 0;
}
当执行达到 PEM_write_X509 时,它会卡住并且不会继续。我猜,它进入了无限循环,执行并没有超出这个范围。一个控制台简单地打开,它不会消失。有人请帮忙