Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts an encrypted data stream from an io.Reader into an io.Writer using the specified key, and returns the number of bytes written to the io.Writer.
func DecryptN ¶
DecryptN decrypts an encrypted data stream from an io.Reader into an io.Writer using the specified key, and returns the number of bytes written to the io.Writer. The maximum length limits the number of bytes to read from the input stream (including the encryption block headers.) If the maximum length is set to zero, the function consumes all bytes in the input stream. Nonces are read from the input stream.
func Encrypt ¶
Encrypt encrypts data from an io.Reader into an io.Writer using the specified key, and returns the number of bytes written to the io.Writer.
Example ¶
r := bytes.NewBufferString("Vanilla Plaintext") w := &bytes.Buffer{} key, err := RandomAES128Key() if err != nil { log.Fatal(err) } n, err := Encrypt(r, w, key) if err != nil { log.Fatal(err) } fmt.Printf("Wrote %d encrypted bytes\n", n)
Output: Wrote 57 encrypted bytes
func RandomAES128Key ¶
RandomAES128Key returns a randomly generated AES128 key.
func RandomAES256Key ¶
RandomAES256Key returns a randomly generated AES256 key.
Types ¶
This section is empty.