Documentation ¶
Overview ¶
Package encrypted implements an encryption codec which encodes data by encrypting and authenticating with a cipher.AEAD instance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
A Codec implements the encoded.Codec interface and encrypts and authenticates data using a cipher.AEAD instance.
func New ¶
New constructs an encryption codec that uses the given encryption context. If opts == nil, default options are used. New will panic if aead == nil.
For AES-GCM, you can use the cipher.NewGCM constructor. For ChaCha20-Poly1305 (RFC 8439) see golang.org/x/crypto/chacha20poly1304.
func (*Codec) Decode ¶
Decode implements part of the codec interface. It decodes src from a wrapper block, decrypts the message, and writes the result to w. If decryption fails, an error is reported without writing any data to w.
func (*Codec) DecodedLen ¶
DecodedLen implements part of the codec interface. It decodes src from a wrapper block, decrypts the original size, and returns it.