ssl.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           ssl.h  -  description
00003                              -------------------
00004     begin                : Thu Dec 9 2004
00005     copyright            : (C) 2004 by VooDooMan
00006     email                : vdmfun@hotmail.com
00007  ***************************************************************************/
00008 
00009 #ifndef SSL_H_
00010 #define SSL_H_
00011 
00012 #include <string>
00013 #include <vector>
00014 
00015 #include <openssl/rsa.h>       /* SSLeay stuff */
00016 #include <openssl/crypto.h>
00017 #include <openssl/x509.h>
00018 #include <openssl/pem.h>
00019 #include <openssl/ssl.h>
00020 #include <openssl/err.h>
00021 
00022 #include "sock.h"
00023 
00024 /*!
00025     \file
00026     \brief Provides SSL socket communication
00027 */
00028 
00029 using namespace std;
00030 
00031 /*!
00032     \brief Stores configuration data (ssl.txt) for one bot to accept its connection via SSL
00033     \author VooDooMan
00034     \version 1
00035     \date 2004
00036 */
00037 struct s_ssl_bot {
00038     string botname;                 //!< Name of bot from logic.txt
00039     string cert;                    //!< Path to its client's certificate
00040 };
00041 
00042 /*!
00043     \brief Stores configuration from ssl.txt
00044     \author VooDooMan
00045     \version 1
00046     \date 2004
00047 */
00048 struct s_ssl_conf {
00049     string accept_ca_certs;         //!< File containing certificates of CA's that we are trust
00050     string server_cert;             //!< Path to file with server's certificate chain
00051     string server_key;              //!< Path to file with server's private key
00052     string client_cert;             //!< Path to file with client certificate chain we use to connect as client to another bot
00053     string client_key;              //!< Path to file with key for client certificate
00054     vector<s_ssl_bot> ssl_bots;     //!< Array of bots to use SSL for incomming connection
00055 };
00056 
00057 bool ssl_init(char* err_str, char* trustedCAs);
00058 bool ssl_server_connection(SSL* &ssl, s_socket* client, char* err_str, char* server_cert, char* server_key, char* expected_client_cert);
00059 bool ssl_server_read(SSL* ssl, s_socket* client, char* err_str, char* buf, size_t buf_len, size_t &buf_got);
00060 void ssl_close(SSL* ssl, s_socket* peer);
00061 bool ssl_client_connection(SSL* &ssl, s_socket* server, char* err_str, char* client_cert, char* client_key);
00062 bool ssl_client_read(SSL* ssl, s_socket* client, char* err_str, char* buf, size_t buf_len, size_t &buf_got);
00063 bool ssl_write(SSL* ssl, s_socket* peer, char* err_str, char* buf, size_t buf_len);
00064 bool ssl_server_accept(SSL* ssl, s_socket* client);
00065 
00066 void ssl_do_read_write(SSL* ssl);
00067 
00068 #endif
00069 

Generated on Sun Jul 10 03:23:03 2005 for VooDoo cIRCle by doxygen 1.4.3

Hosted by SourceForge.net Logo