[openssl-users] Extracting decrypt key for AES from openssl on client side

Viktor Dukhovni openssl-users at dukhovni.org
Wed Nov 14 16:28:04 UTC 2018



> On Nov 14, 2018, at 6:54 AM, Hemant Ranvir <hemantranvir at gmail.com> wrote:
> 
> My main goal here is to use openssl for initial handshake sequence. Once the connection is established between server and client, decrypt the incoming message (this time not using the openssl api but rather by using the decrypt AES function implemented earlier)

This makes no sense, because TLS does not just emit a simple CBC encrypted stream
after performing the handshake.  So you can't do that.  Use SSL_read()/SSL_write,
and let the library do the message decryption/encryption for you.  When done use
SSL_shutdown() to cleanly terminate the stream, and depending on the application
protocol, make wait for the peer's SSL_shutdown() in turn to avoid truncation
attacks where completion of the stream is not implied by the higher level protocol.

-- 
	Viktor.



More information about the openssl-users mailing list