openssl 관련 소스 실행이 안됩니다. 도움꼭 부탁드려요
작성자 정보
- 임희찬 작성
- 작성일
컨텐츠 정보
- 3,785 조회
- 0 추천
- 목록
본문
여기저기 도움을 얻어서 아래와 같은 openssl 소스까지 갔습니다.
그런데 계속 런타임 에러만 나네요. (리눅스 소스를 윈도우로 바꿔
서 실행중입니다. 마땅히 질문드릴때가 없어서.. 죄송합니다.)
디버깅 해본 결과는.
// meth = SSLv3_method();
meth = TLSv1_method();
이부분에서 계속 meth 값이 NULL이 나옵니다.
meth = SSLv23_client_method(); 등 여러가지를 써보았는데
도 계속 실행이 안되네여..
컴파일, 링크까지는 진행되었지만 런타임때 에러가 나서 정말 답답합니다.
고수님들 꼭 도움 부탁드립니다.
#include <openssl/rsa.h> /* SSLeay stuff */
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <stdio.h>
#include <string.h>
// OpenSSL library를 사용하기 위해 필요한 초기화 작업을 한다.
#define SETUP_OPENSSL {
OpenSSL_add_all_algorithms();
OpenSSL_add_all_ciphers();
ERR_load_crypto_strings();
static const char rnd_seed[] = "string to make the random number generator think it has entropy";
RAND_seed(rnd_seed, sizeof(rnd_seed));
}
int main()
{
SETUP_OPENSSL;
BIO * bio;
SSL * ssl;
SSL_CTX * ctx;
SSL_METHOD *meth;
int p;
char * request = "GET / HTTP/1.1x0Dx0AHost: www.verisign.comx0Dx0Ax43onnection: Closex0Dx0Ax0Dx0A";
char r[1024];
char *pathcert = "c:\OpenSSL\bin\cert";
/* Set up the library */
// meth = SSLv3_method();
meth = TLSv1_method();
// create a new SSL_CTX object as framework for TLS/SSL enabled functions
ctx = SSL_CTX_new (meth);
if (!ctx) {
printf("error!!!!
");
ERR_print_errors_fp(stderr);
exit(2);
}
/* Load the trust store */
if(!SSL_CTX_load_verify_locations(ctx, "c:\OpenSSL\bin\PEM\ca-cert.pem",NULL))
{
printf("error!!!
");
//fprintf(stderr, "Error loading trust store
");
//ERR_print_errors_fp(stderr);
//SSL_CTX_free(ctx);
return 0;
}
관련자료
-
이전
-
다음