Using keying material generated by OpenSSL handshake to encrypt/decrypt data locally
I'm currently working on a project which requires OpenSSL encryption. Due to design considerations (which are unfeasible to work around) the encryption process has to be along these lines:
1) Perform SSL handshake 2) Obtain keying material generated from the handshake 3) Use said keying material to encrypt/decrypt the data locally, while 4) Obtain and send encrypted data using an external mechanism
Stage 1 has been easy to perform, and stage 4 is already implemented, so currently my problem is narrowed down to obtaining the keying material generated from the handshake and using it to encrypt/decrypt locally. I'm guessing the proper way to do it would be to create a BIO which isn't configured to write to a socket but to a local memory segment. However, I was unable to create such BIO. I tried going through OpenSSL's documentation, but it is very very lacking, so any crumbs of insight from anyone who is experienced with it will be more than helpful.
Thanks in advance for landing开发者_Python百科 a hand, or at least for reading so far :)
I think BIO_s_mem() is the way to go for you.
http://www.openssl.org/docs/crypto/BIO_s_mem.html
http://books.google.com/books?id=IIqwAy4qEl0C&lpg=PT105&ots=ma051L5CVu&hl=en&pg=PT107#v=onepage&q&f=false
精彩评论