I am working on a ethical hacking 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.
0 comments:
Post a Comment