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

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package aead
     8  
     9  import (
    10  	tinkpb "github.com/google/tink/go/proto/tink_go_proto"
    11  
    12  	"github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/tinkcrypto/primitive/aead"
    13  )
    14  
    15  // This file contains pre-generated KeyTemplates for AEAD keys. One can use these templates to generate new Keysets.
    16  // These templates are based on the CBC-HMAC parameters defined at:
    17  // https://datatracker.ietf.org/doc/html/draft-mcgrew-aead-aes-cbc-hmac-sha2-05#section-2.8.
    18  
    19  // AES128CBCHMACSHA256KeyTemplate is a KeyTemplate that generates an AES-CBC-HMAC-AEAD key with the following
    20  // parameters:
    21  //   - AES key size: 16 bytes
    22  //   - HMAC key size: 16 bytes
    23  //   - HMAC tag size: 16 bytes
    24  //   - HMAC hash function: SHA256
    25  func AES128CBCHMACSHA256KeyTemplate() *tinkpb.KeyTemplate {
    26  	return aead.AES128CBCHMACSHA256KeyTemplate()
    27  }
    28  
    29  // AES192CBCHMACSHA384KeyTemplate is a KeyTemplate that generates an AES-CBC-HMAC-AEAD key with the following
    30  // parameters:
    31  //   - AES key size: 24 bytes
    32  //   - HMAC key size: 24 bytes
    33  //   - HMAC tag size: 24 bytes
    34  //   - HMAC hash function: SHA384
    35  func AES192CBCHMACSHA384KeyTemplate() *tinkpb.KeyTemplate {
    36  	return aead.AES192CBCHMACSHA384KeyTemplate()
    37  }
    38  
    39  // AES256CBCHMACSHA384KeyTemplate is a KeyTemplate that generates an AES-CBC-HMAC-AEAD key with the following
    40  // parameters:
    41  //   - AES key size: 32 bytes
    42  //   - HMAC key size: 24 bytes
    43  //   - HMAC tag size: 24 bytes
    44  //   - HMAC hash function: SHA384
    45  func AES256CBCHMACSHA384KeyTemplate() *tinkpb.KeyTemplate {
    46  	return aead.AES256CBCHMACSHA384KeyTemplate()
    47  }
    48  
    49  // AES256CBCHMACSHA512KeyTemplate is a KeyTemplate that generates an AES-CBC-HMAC-AEAD key with the following
    50  // parameters:
    51  //   - AES key size: 32 bytes
    52  //   - HMAC key size: 32 bytes
    53  //   - HMAC tag size: 32 bytes
    54  //   - HMAC hash function: SHA512
    55  func AES256CBCHMACSHA512KeyTemplate() *tinkpb.KeyTemplate {
    56  	return aead.AES256CBCHMACSHA512KeyTemplate()
    57  }