Documentation ¶
Index ¶
Constants ¶
View Source
const ( KeyLength = chacha20poly1305.KeySize CipherTextMinLength = chacha20poly1305.NonceSize + chacha20poly1305.Overhead )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SymmetricCipher ¶
type SymmetricCipher struct {
// contains filtered or unexported fields
}
SymmetricCipher is a wrapper around the AEAD interface from the golang.org/x/crypto/chacha20poly1305 package.
func New ¶
func New(key []byte) (*SymmetricCipher, error)
New returns a new Cipher instance. If a Cipher instance with the same key has already been created, it will be returned instead.
func (*SymmetricCipher) NewDecryptingReader ¶
func (cipher *SymmetricCipher) NewDecryptingReader(src io.Reader) (io.ReadCloser, error)
NewDecryptingReader returns a new io.ReadCloser that decrypts src with the cipher
func (*SymmetricCipher) NewEncryptingWriter ¶
func (cipher *SymmetricCipher) NewEncryptingWriter(dst io.Writer, compress bool) (io.WriteCloser, error)
NewEncryptingWriter returns a new io.WriteCloser that encrypts data with the cipher and writes to dst.
Click to show internal directories.
Click to hide internal directories.