📄 dhdhy.cpp
字号:
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <errno.h>
#include <sys/types.h>
#include <winsock2.h>
#include "openssl/rsa.h"
#include "openssl/crypto.h"
#include "openssl/x509.h"
#include "openssl/pem.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
#include "openssl/rand.h"
int main()
{
X509 *x;
FILE *fp;
unsigned char buf[5000],*p;
int len,ret;
BIO *b;
/* cert.cer为DER编码的数字证书
用户如果是windows系统,可以从IE中导出一个x509v3的数字证书作为解析目标
*/
fp=fopen("cert.cer","rb");
if(!fp) return -1;
len=fread(buf,1,5000,fp);
fclose(fp);
p=buf;
x=X509_new();
d2i_X509(&x,(unsigned char **)&p,len);
b=BIO_new(BIO_s_file());
BIO_set_fp(b,stdout,BIO_NOCLOSE);
ret=X509_print(b,x);
BIO_free(b);
X509_free(x);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -