May 2019
Intermediate to advanced
478 pages
11h 21m
English
Let's go over some basics of using the OpenSSL library in server applications before beginning a concrete example.
Before OpenSSL can be used, it must be initialized. The following code initializes the OpenSSL library, loads the requisite encryption algorithms, and loads useful error strings:
SSL_library_init();OpenSSL_add_all_algorithms();SSL_load_error_strings();
Refer to the previous Chapter 9, Loading Secure Web Pages with HTTPS and OpenSSL, for more information.
Our server also needs to create an SSL context object. This object works as a sort of factory from which we can create TLS/SSL connections.
The following code creates the SSL_CTX object:
SSL_CTX *ctx = SSL_CTX_new(TLS_server_method());if (!ctx) { fprintf(stderr, ...Read now
Unlock full access