github.com/trustbloc/kms-go@v1.1.2/crypto/tinkcrypto/primitive/composite/aead_enc_helper.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package composite
     8  
     9  import (
    10  	"github.com/google/tink/go/tink"
    11  )
    12  
    13  // EncrypterHelper is a helper for Content Encryption of composite ECDH (ES/1PU) key wrapping + AEAD content encryption
    14  // This interface is used internally by the composite primitives.
    15  type EncrypterHelper interface {
    16  	// GetAEAD returns the newly created AEAD primitive used for the content Encryption
    17  	GetAEAD(symmetricKeyValue []byte) (tink.AEAD, error)
    18  
    19  	// GetTagSize provides the aead primitive tag size
    20  	GetTagSize() int
    21  
    22  	// GetIVSize provides the aead primitive nonce size
    23  	GetIVSize() int
    24  
    25  	// BuildEncData will build the []byte representing the ciphertext sent to the end user as a result of the Composite
    26  	// Encryption primitive execution
    27  	BuildEncData(ct []byte) ([]byte, error)
    28  
    29  	// BuildDecData will build the []byte representing the ciphertext coming from encData struct returned as a result of
    30  	// Composite Encrypt() call to prepare the Composite Decryption primitive execution
    31  	BuildDecData(encData *EncryptedData) []byte
    32  }