daead

package
v1.3.0-rc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 10

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL