Merge pull request #12 from bramp/cipher-name

Add SSL_get_cipher_name(...)
This commit is contained in:
JT Olds 2014-10-08 01:09:43 -06:00
commit db59c1a898

12
conn.go
View File

@ -28,6 +28,9 @@ package openssl
// long SSL_set_tlsext_host_name_not_a_macro(SSL *ssl, const char *name) {
// return SSL_set_tlsext_host_name(ssl, name);
// }
// const char * SSL_get_cipher_name_not_a_macro(const SSL *ssl) {
// return SSL_get_cipher_name(ssl);
// }
import "C"
import (
@ -144,6 +147,15 @@ func Server(conn net.Conn, ctx *Ctx) (*Conn, error) {
return c, nil
}
func (c *Conn) CurrentCipher() (string, error) {
p := C.SSL_get_cipher_name_not_a_macro(c.ssl)
if p == nil {
return "", errors.New("Session not established")
}
return C.GoString(p), nil
}
func (c *Conn) fillInputBuffer() error {
for {
n, err := c.into_ssl.ReadFromOnce(c.conn)