Openssl example

This is a complete example on how to use openssl to fetch a https page. The example is based on the several others I found on the web so my credit is minimal and only consist of modifying just a little the existing examples to compile and work with openssl-0.9.8e on Linux and Solaris. The example #include <openssl/ssl.h> #include <openssl/err.h> #include <openssl/bio.h> #include <iostream> #define MAX_PACKET_SIZE 10000 int main() { BIO * bio; SSL * ssl; SSL_CTX * ctx; /* Initializing OpenSSL */ SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); SSL_library_init(); //mandatory and missing from some examples ctx = SSL_CTX_new(SSLv23_client_method()); if (ctx == NULL) { std::cout << "Ctx is null" << std::endl; ERR_print_errors_fp(stderr); } //using a store from examples if(!...

June 5, 2007 ยท len