注册 登录
自由的生活_软路由 返回首页

的个人空间 https://www.routerclub.com/?0 [收藏] [复制] [分享] [RSS]

日志

读取rsa的私钥key

已有 93 次阅读2007-12-16 21:01

#include <openssl/md5.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <string.h>
#include <stdio.h>

#define RSA_KEY_FILE "rsakey.txt"
// > openssl genrsa -out rsakey.txt 1024

int main(void)
{
        RSA* rsa = NULL;
        FILE* fp = NULL;

        if((fp = fopen("sec.pem", "r")) == NULL)
        {
                fprintf(stderr, "unable to open CAKey file\n");
                return;
        }

        PEM_read_RSAPrivateKey(fp, &rsa, NULL, NULL);

        if(rsa == NULL)
        {
                fprintf(stderr, "rsa is NULL\n");
                return;
     }
RSA_free(rsa);

}


路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2025-7-12 15:17 , Processed in 0.079717 second(s), 14 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

返回顶部