Documentation
¶
Overview ¶
Package daead provides implementations of the DeterministicAEAD primitive. Unlike AEAD, implementations of this interface are not semantically secure, because encrypting the same plaintex always yields the same ciphertext. Example:
package main
import (
"fmt" "github.com/google/tink/go/daead" "github.com/google/tink/go/keyset"
)
func main() {
kh, err := keyset.NewHandle(daead.AESSIVKeyTemplate())
if err != nil {
// handle the error
}
d := daead.New(kh)
ct1 , err := d.EncryptDeterministically([]byte("this data needs to be encrypted"), []byte("additional data"))
if err != nil {
// handle error
}
pt , err := d.DecryptDeterministically(ct, []byte("additional data"))
if err != nil {
// handle error
}
ct2 , err := d.EncryptDeterministically([]byte("this data needs to be encrypted"), []byte("additional data"))
if err != nil {
// handle error
}
// ct1 will be equal to ct2
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESSIVKeyTemplate ¶
func AESSIVKeyTemplate() *tinkpb.KeyTemplate
AESSIVKeyTemplate is a KeyTemplate that generates a AES-SIV key.
func New ¶
func New(h *keyset.Handle) (tink.DeterministicAEAD, error)
New returns a DeterministicAEAD primitive from the given keyset handle.
func NewWithKeyManager ¶
func NewWithKeyManager(h *keyset.Handle, km registry.KeyManager) (tink.DeterministicAEAD, error)
NewWithKeyManager returns a DeterministicAEAD primitive from the given keyset handle and custom key manager.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.