Documentation
¶
Index ¶
- Constants
- func DeriveKey(password string) ([]byte, error)
- func DeriveSessionKey(key, serverNonce, clientNonce []byte) []byte
- func GenerateKey() (string, error)
- func HandleAuthHandshake(r *bufio.Reader, w io.Writer, key []byte, isClient bool) (clientNonce, serverNonce []byte, err error)
- func IsAuthHandshake(r *bufio.Reader) (bool, error)
- func ReadClientNonce(r io.Reader) (clientNonce []byte, err error)
- func WrapConn(conn net.Conn, sessionKey []byte) (net.Conn, error)
- func WriteServerHandshake(w io.Writer) (serverNonce []byte, err error)
- type Conn
Constants ¶
View Source
const ( AutoGenKeyLength = 16 Base62Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" PBKDF2Iterations = 100000 PBKDF2Salt = "VIIPER-Key-v1" )
View Source
const ( HandshakeMagic = "eVI1\x00" NonceSize = 32 )
Variables ¶
This section is empty.
Functions ¶
func DeriveSessionKey ¶
DeriveSessionKey creates unique session key from key and nonces SHA mixing is used for easier client implementations
func GenerateKey ¶
GenerateKey creates a random 16-char base62 key
func HandleAuthHandshake ¶
func HandleAuthHandshake(r *bufio.Reader, w io.Writer, key []byte, isClient bool) (clientNonce, serverNonce []byte, err error)
HandleAuthHandshake performs the authentication handshake
func IsAuthHandshake ¶
IsAuthHandshake checks if the next bytes in reader match the handshake magic
func ReadClientNonce ¶
ReadClientNonce reads client nonce from handshake Expects handshake magic already consumed, reads only the 32-byte nonce
Types ¶
Click to show internal directories.
Click to hide internal directories.