How to properly serialize an SSLSession?

Let’s say I want to save some HTTP response for the purpose of caching (into disk or memory). The response has an optional SSLSession property that is only present if the client initiated an HTTPS connection. Of course, I want the response to be recoverable which means the SSLSession must somehow be serialized in a recoverable manner. The SSLSession (or ExtendedSSLSession) is not Serializable so this leaves Java serialization out of the equation. I’m guessing one could come up with a custom format as most properties have a byte representation (e.g. certificates, primitive properties) but there are some complex fields I’m not sure how to approach (e.g. SSLSessionContext). So how do I properly achieve this?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.