go1.20.5
GoThrough

box.AnonymousOverhead

// AnonymousOverhead is the number of bytes of overhead when using anonymous // sealed boxes. const AnonymousOverhead = Overhead + 32

box.Overhead

// Overhead is the number of bytes of overhead when boxing a message. const Overhead = secretbox.Overhead

box.GenerateKey

// GenerateKey generates a new public/private key pair suitable for use with // Seal and Open. func GenerateKey(rand io.Reader) (publicKey *[32]byte, privateKey *[32]byte, err error)

box.Open

// Open authenticates and decrypts a box produced by Seal and appends the // message to out, which must not overlap box. The output will be Overhead // bytes smaller than box. func Open(out []byte, box []byte, nonce *[24]byte, peersPublicKey *[32]byte, privateKey *[32]byte) ([]byte, bool)

box.OpenAfterPrecomputation

// OpenAfterPrecomputation performs the same actions as Open, but takes a // shared key as generated by Precompute. func OpenAfterPrecomputation(out []byte, box []byte, nonce *[24]byte, sharedKey *[32]byte) ([]byte, bool)

box.OpenAnonymous

// OpenAnonymous authenticates and decrypts a box produced by SealAnonymous and // appends the message to out, which must not overlap box. The output will be // AnonymousOverhead bytes smaller than box. func OpenAnonymous(out []byte, box []byte, publicKey *[32]byte, privateKey *[32]byte) (message []byte, ok bool)

box.Precompute

// Precompute calculates the shared key between peersPublicKey and privateKey // and writes it to sharedKey. The shared key can be used with // OpenAfterPrecomputation and SealAfterPrecomputation to speed up processing // when using the same pair of keys repeatedly. func Precompute(sharedKey *[32]byte, peersPublicKey *[32]byte, privateKey *[32]byte)

box.Seal

// Seal appends an encrypted and authenticated copy of message to out, which // will be Overhead bytes longer than the original and must not overlap it. The // nonce must be unique for each distinct message for a given pair of keys. func Seal(out []byte, message []byte, nonce *[24]byte, peersPublicKey *[32]byte, privateKey *[32]byte) []byte

box.SealAfterPrecomputation

// SealAfterPrecomputation performs the same actions as Seal, but takes a // shared key as generated by Precompute. func SealAfterPrecomputation(out []byte, message []byte, nonce *[24]byte, sharedKey *[32]byte) []byte

box.SealAnonymous

// SealAnonymous appends an encrypted and authenticated copy of message to out, // which will be AnonymousOverhead bytes longer than the original and must not // overlap it. This differs from Seal in that the sender is not required to // provide a private key. func SealAnonymous(out []byte, message []byte, recipient *[32]byte, rand io.Reader) ([]byte, error)