openssl 获取证书中的公钥
PEM 格式
1. FILE *fp = fopen("xx.pem", "r");
2. X509 *cert = PEM_read_X509(fp, NULL, NULL, NULL);
3. EVP_PKEY *pkey = X509_get_pubkey(cert)
der 格式
1. FILE *fp = fopen("xx.cer", "r");
2. X509 *cert = d2i_X509_fp(fp, NULL);
3. EVP_PKEY *pkey = X509_get_pubkey(cert)
PEM 用记事本可以打开查看 为 base64 编码
der 是二进制格式,用记事本打开为乱码