Decryption of openssl packets with static certificates

I am working on an ethical hacking https://goo.gl/mFYtki project to monitor all the encrypted packets through OpenSSL. I do have both the public and private keys (cert files). My application code snippet for regular packet decryption is as follows:

SSL_library_init();
ctx = InitCTX();
server = OpenConnection(hostname, atoi(portnum));
ssl = SSL_new(ctx); /* create new SSL connection state */
SSL_set_fd(ssl, server); /* attach the socket descriptor */
ShowCerts(ssl); /* get any certs */
SSL_write(ssl,acClientRequest, strlen(acClientRequest)); /* encrypt & send message */
bytes = SSL_read(ssl, buf, sizeof(buf)); /* get reply & decrypt */
SSL_free(ssl); /* release connection state */

SSL_read basically gets the certificate at the time of handshaking and utilizes it for decrypting the data. Is there any way to provide the same certificate offline for decryption of data.

Any help/pointers would be highly appreciable.
Last edited on
Topic archived. No new replies allowed.