Converting .crt to .pem using OpenSSL API
问题 Can anyone show me how to convert .crt files to .pem files using the openssl API? I tried it like this: FILE *fl = fopen(cert_filestr, "r"); fseek(fl, 0, SEEK_END); long len = ftell(fl); char *ret = malloc(len); fseek(fl, 0, SEEK_SET); fread(ret, 1, len, fl); fclose(fl); BIO* input = BIO_new_mem_buf((void*)ret, sizeof(ret)); x509 = d2i_X509_bio(input, NULL); FILE* fd = fopen(certificateFile, "w+"); BIO* output = BIO_new_fp(fd, BIO_NOCLOSE); X509_print_ex(output, x509, XN_FLAG_COMPAT, X509