我使用下面的server.c源码,我生成了
sinful-host-cert.pem sinful-host.key
如下所述:椭圆曲线CA指南
运行程序时会出现以下错误:
140722397161136:错误:10071065:椭圆曲线例程:func(113):reason(101):ec_lib.c:995:140722397161136:错误:0B080075:x509证书例程:func(128):reason(117):x509_cmp.c: 346:
我编译使用:
gcc server.c -ldl -lcrypto -lssl -o Server
我认为错误发生在这一行
if (SSL_CTX_use_PrivateKey_file(ctx, KeyFile, SSL_FILETYPE_PEM) <= 0)
#include <errno.h>
#include <unistd.h>
#include <malloc.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <resolv.h>
#include "openssl/ssl.h"
#include "openssl/err.h"
#define FAIL -1
int OpenListener(int port)
{ int sd;
struct sockaddr_in addr;
sd = socket(PF_INET, SOCK_STREAM, 0);
bzero(&addr, sizeof(addr));
inet_aton("10.8.0.26", &addr.sin_addr);
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
//addr.sin_addr.s_addr = INADDR_ANY;
if ( bind(sd, (struct …Run Code Online (Sandbox Code Playgroud)