Skip to main content

How do I use cookies for sharing callbacks?

Question: I'm using the TrustCore SDK source code in a shared library for both a client application and a server application. I want to create only one set of callback functions and have them perform differently for the client versus the server. Is there a way to pass context information into a callback function?

Answer: Yes. Use the SSL_setCookie routine to associate custom information (cookie data) with a connection instance. If context information is stored in the cookie, callback functions may use the SSL_getCookie routine to retrieve the cookie and determine the context.