相关配置等请参看上一篇关于server端文章:http://blog.csdn.net/pingd/article/details/47805349
1.Client端源码:
openssl_client.c
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/socket.h>
#include <resolv.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#define MAXBUF 1024
void ShowCerts(SSL * ssl)
{
X509 *cert;
char *line;
cert = SSL_get_peer_certificate(ssl);
if (cert != NULL) {
printf("Digital cert info:\n");
line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
printf("Cert: %s\n", line);
free(line);
line = X5