github.com/hyperledger/aries-framework-go@v0.3.2/pkg/crypto/tinkcrypto/primitive/composite/composite.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  // Package composite provides the core crypto composite primitives such as ECDH-ES and ECDH-1PU to be used by JWE crypto
     8  package composite
     9  
    10  import (
    11  	tinkpb "github.com/google/tink/go/proto/tink_go_proto"
    12  
    13  	"github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/tinkcrypto/primitive/composite"
    14  )
    15  
    16  // EncryptedData represents the Encryption's output data as a result of ECDHEncrypt.Encrypt(pt, aad) call
    17  // The user of the primitive must unmarshal the result and build their own ECDH-ES/1PU compliant message (ie JWE msg).
    18  type EncryptedData = composite.EncryptedData
    19  
    20  // EncrypterHelper is a helper for Content Encryption of composite ECDH (ES/1PU) key wrapping + AEAD content encryption
    21  // This interface is used internally by the composite primitives.
    22  type EncrypterHelper = composite.EncrypterHelper
    23  
    24  const (
    25  	// AESCBCHMACAEADTypeURL for AESCBC+HMAC AEAD content encryption URL.
    26  	AESCBCHMACAEADTypeURL = composite.AESCBCHMACAEADTypeURL
    27  	// AESGCMTypeURL for AESGCM content encryption URL identifier.
    28  	AESGCMTypeURL = composite.AESGCMTypeURL
    29  	// ChaCha20Poly1305TypeURL for Chacha20Poly1305 content encryption URL identifier.
    30  	ChaCha20Poly1305TypeURL = composite.ChaCha20Poly1305TypeURL
    31  	// XChaCha20Poly1305TypeURL for XChachaPoly1305 content encryption URL identifier.
    32  	XChaCha20Poly1305TypeURL = composite.XChaCha20Poly1305TypeURL
    33  )
    34  
    35  // RegisterCompositeAEADEncHelper registers a content encryption helper.
    36  type RegisterCompositeAEADEncHelper = composite.RegisterCompositeAEADEncHelper
    37  
    38  // NewRegisterCompositeAEADEncHelper initializes and returns a RegisterCompositeAEADEncHelper.
    39  //
    40  //nolint:gocyclo
    41  func NewRegisterCompositeAEADEncHelper(k *tinkpb.KeyTemplate) (*RegisterCompositeAEADEncHelper, error) {
    42  	return composite.NewRegisterCompositeAEADEncHelper(k)
    43  }