7. SSL

     void *cs_get_ssl(COMSTACK cs);
    

Returns the SSL handle, SSL * for comstack. If comstack is not of type SSL, then NULL is returned.

     int cs_set_ssl_ctx(COMSTACK cs, void *ctx);
    

Sets SSL context for comstack. The parameter is expected to be of type SSL_CTX *. This function should be called just after comstack has been created (before connect, bind, etc). This function returns 1 for success; 0 for failure.

     int cs_set_ssl_certificate_file(COMSTACK cs, const char *fname);
    

Sets SSL certificate for comstack as a PEM file. This function returns 1 for success; 0 for failure.

     int cs_get_ssl_peer_certificate_x509(COMSTACK cs, char **buf, int *len);
    

This function returns the peer certificate. If successful, *buf and *len holds X509 buffer and length respectively. Buffer should be freed with xfree. This function returns 1 for success; 0 for failure.