mirror of
https://github.com/libp2p/go-openssl.git
synced 2025-01-15 02:40:09 +08:00
Merge pull request #12 from bramp/cipher-name
Add SSL_get_cipher_name(...)
This commit is contained in:
commit
db59c1a898
12
conn.go
12
conn.go
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user