Documentation
¶
Overview ¶
Package noise implements the Noise_NNpsk0_25519_ChaChaPoly_SHA256 handshake pattern from the Noise Protocol Framework (revision 34), which is all of Noise that mote needs: an ephemeral-ephemeral key agreement mixed with a pre-shared key established out of band (by the CPace exchange).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CipherState ¶
type CipherState struct {
// contains filtered or unexported fields
}
A CipherState encrypts or decrypts a sequence of messages with a key and an incrementing nonce, as defined in Noise §5.1.
type HandshakeState ¶
type HandshakeState struct {
// contains filtered or unexported fields
}
A HandshakeState runs the two-message NNpsk0 handshake:
-> psk, e <- e, ee
Once WriteMessage or ReadMessage returns an error, the HandshakeState is dead and every later call returns an error too.
func NewHandshakeState ¶
func NewHandshakeState(initiator bool, psk []byte) (*HandshakeState, error)
NewHandshakeState returns a HandshakeState using the 32-byte pre-shared key psk. The initiator sends the first message.
func (*HandshakeState) ReadMessage ¶
func (hs *HandshakeState) ReadMessage(out, message []byte) ([]byte, *CipherState, *CipherState, error)
ReadMessage processes the next handshake message, appending the decrypted payload to out. On the final handshake message it also returns the two transport cipher states, in the order returned by split.
func (*HandshakeState) WriteMessage ¶
func (hs *HandshakeState) WriteMessage(out, payload []byte) ([]byte, *CipherState, *CipherState, error)
WriteMessage appends the next handshake message, carrying the encrypted payload, to out. On the final handshake message it also returns the two transport cipher states, in the order returned by split.