session

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2024 License: ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEncrypt        = errors.New("encrypt failure")
	ErrDecrypt        = errors.New("decrypt failure")
	ErrOverflow       = errors.New("message too large")
	ErrInvalidKx      = errors.New("invalid kx")
	ErrMarshal        = errors.New("could not marshal")
	ErrUnmarshal      = errors.New("could not unmarshal")
	ErrNilTheirPubKey = errors.New("nil TheirPublicKey")
)

Functions

This section is empty.

Types

type KX

type KX struct {
	Conn           io.ReadWriter
	MaxMessageSize uint
	OurPrivateKey  *zkidentity.FixedSizeSntrupPrivateKey
	OurPublicKey   *zkidentity.FixedSizeSntrupPublicKey
	TheirPublicKey *zkidentity.FixedSizeSntrupPublicKey
	// contains filtered or unexported fields
}

KX allows two peers to derive a pair of shared keys. One peer must trigger Initiate (the client) while the other (the server) should call Init once followed by Respond for each connection.

func (*KX) Initiate

func (kx *KX) Initiate() error

Initiate performs a key exchange on behalf of a connecting client. A key exchange involves the following variables: k1, k2, k3, k4: NTRU Prime shared keys. c1, c2, c3, c4: NTRU Prime ciphertexts corresponding to k1, k2, k3, k4. From the perspective of the initiator, the process unfolds as follows:

func (*KX) Read

func (kx *KX) Read() ([]byte, error)

func (*KX) Respond

func (kx *KX) Respond() error

Respond performs a key exchange on behalf of a responding server. A key exchange involves the following variables: k1, k2, k3, k4: NTRU Prime shared keys. c1, c2, c3, c4: NTRU Prime ciphertexts corresponding to k1, k2, k3, k4. From the perspective of the responder, the process unfolds as follows:

func (*KX) Write

func (kx *KX) Write(data []byte) error

Write encrypts and marshals data to the underlying writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL