| 1 | // Copyright 2018 Google LLC |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package aeadscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/ |
| 16 | |
| 17 | import ( |
| 18 | "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/" |
| 19 | |
| 20 | "google.golang.org/protobuf/protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/" |
| 21 | "github.com/tink-crypto/tink-go/v2/internal/tinkerrorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/" |
| 22 | ctrpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/" |
| 23 | ctrhmacpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_hmac_aead_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/aes_ctr_hmac_aead_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_hmac_aead_go_proto`/" |
| 24 | gcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/aes_gcm_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_go_proto`/" |
| 25 | gcmsivpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_siv_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/aes_gcm_siv_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_siv_go_proto`/" |
| 26 | commonpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/common_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/common_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/common_go_proto`/" |
| 27 | hmacpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/hmac_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/" |
| 28 | kmsenvpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/kms_envelope_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/kms_envelope_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/kms_envelope_go_proto`/" |
| 29 | tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/tink_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/" |
| 30 | xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/ "github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_protoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/" |
| 31 | ) |
| 32 | |
| 33 | const ( |
| 34 | aesGCMTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/aesGCMTypeURL. = "type.googleapis.com/google.crypto.tink.AesGcmKey" |
| 35 | xAESGCMTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/xAESGCMTypeURL. = "type.googleapis.com/google.crypto.tink.XAesGcmKey" |
| 36 | chaCha20Poly1305TypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/chaCha20Poly1305TypeURL. = "type.googleapis.com/google.crypto.tink.ChaCha20Poly1305Key" |
| 37 | xChaCha20Poly1305TypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/xChaCha20Poly1305TypeURL. = "type.googleapis.com/google.crypto.tink.XChaCha20Poly1305Key" |
| 38 | aesCTRHMACAEADTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/aesCTRHMACAEADTypeURL. = "type.googleapis.com/google.crypto.tink.AesCtrHmacAeadKey" |
| 39 | aesGCMSIVTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/aesGCMSIVTypeURL. = "type.googleapis.com/google.crypto.tink.AesGcmSivKey" |
| 40 | ) |
| 41 | |
| 42 | // This file contains pre-generated KeyTemplates for AEAD keys. One can use these templates |
| 43 | // to generate new Keysets. |
| 44 | |
| 45 | // AES128GCMKeyTemplate is a KeyTemplate that generates an AES-GCM key with the following parameters: |
| 46 | // - Key size: 16 bytes |
| 47 | // - Output prefix type: TINK |
| 48 | func AES128GCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES128GCMKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 49 | return createAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESGCMKeyTemplate().(16, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK.) |
| 50 | } |
| 51 | |
| 52 | // AES256GCMKeyTemplate is a KeyTemplate that generates an AES-GCM key with the following parameters: |
| 53 | // - Key size: 32 bytes |
| 54 | // - Output prefix type: TINK |
| 55 | func AES256GCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES256GCMKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 56 | return createAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESGCMKeyTemplate().(32, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK.) |
| 57 | } |
| 58 | |
| 59 | // AES256GCMNoPrefixKeyTemplate is a KeyTemplate that generates an AES-GCM key with the following parameters: |
| 60 | // - Key size: 32 bytes |
| 61 | // - Output prefix type: RAW |
| 62 | func AES256GCMNoPrefixKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES256GCMNoPrefixKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 63 | return createAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESGCMKeyTemplate().(32, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_RAWscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_RAW.) |
| 64 | } |
| 65 | |
| 66 | // XAES256GCM192BitNonceKeyTemplate is a KeyTemplate that generates an |
| 67 | // X-AES-GCM key with the following parameters: |
| 68 | // - Salt size: 12 bytes |
| 69 | // - Output prefix type: TINK |
| 70 | func XAES256GCM192BitNonceKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/XAES256GCM192BitNonceKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 71 | return createXAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createXAESGCMKeyTemplate().(12, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK.) |
| 72 | } |
| 73 | |
| 74 | // XAES256GCM192BitNonceNoPrefixKeyTemplate is a KeyTemplate that generates an |
| 75 | // X-AES-GCM key with the following parameters: |
| 76 | // - Salt size: 12 bytes |
| 77 | // - Output prefix type: RAW |
| 78 | func XAES256GCM192BitNonceNoPrefixKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/XAES256GCM192BitNonceNoPrefixKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 79 | return createXAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createXAESGCMKeyTemplate().(12, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_RAWscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_RAW.) |
| 80 | } |
| 81 | |
| 82 | // XAES256GCM160BitNonceKeyTemplate is a KeyTemplate that generates an |
| 83 | // X-AES-GCM key with the following parameters: |
| 84 | // - Salt size: 8 bytes |
| 85 | // - Output prefix type: TINK |
| 86 | func XAES256GCM160BitNonceKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/XAES256GCM160BitNonceKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 87 | return createXAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createXAESGCMKeyTemplate().(8, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK.) |
| 88 | } |
| 89 | |
| 90 | // XAES256GCM160BitNonceNoPrefixKeyTemplate is a KeyTemplate that generates an |
| 91 | // X-AES-GCM key with the following parameters: |
| 92 | // - Salt size: 8 bytes |
| 93 | // - Output prefix type: RAW |
| 94 | func XAES256GCM160BitNonceNoPrefixKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/XAES256GCM160BitNonceNoPrefixKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 95 | return createXAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createXAESGCMKeyTemplate().(8, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_RAWscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_RAW.) |
| 96 | } |
| 97 | |
| 98 | // AES128GCMSIVKeyTemplate is a KeyTemplate that generates an AES-GCM-SIV key with the following parameters: |
| 99 | // - Key size: 16 bytes |
| 100 | // - Output prefix type: TINK |
| 101 | func AES128GCMSIVKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES128GCMSIVKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 102 | return createAESGCMSIVKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESGCMSIVKeyTemplate().(16, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK.) |
| 103 | } |
| 104 | |
| 105 | // AES256GCMSIVKeyTemplate is a KeyTemplate that generates an AES-GCM-SIV key with the following parameters: |
| 106 | // - Key size: 32 bytes |
| 107 | // - Output prefix type: TINK |
| 108 | func AES256GCMSIVKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES256GCMSIVKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 109 | return createAESGCMSIVKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESGCMSIVKeyTemplate().(32, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK.) |
| 110 | } |
| 111 | |
| 112 | // AES256GCMSIVNoPrefixKeyTemplate is a KeyTemplate that generates an AES-GCM key with the following parameters: |
| 113 | // - Key size: 32 bytes |
| 114 | // - Output prefix type: RAW |
| 115 | func AES256GCMSIVNoPrefixKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES256GCMSIVNoPrefixKeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 116 | return createAESGCMSIVKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESGCMSIVKeyTemplate().(32, tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_RAWscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_RAW.) |
| 117 | } |
| 118 | |
| 119 | // AES128CTRHMACSHA256KeyTemplate is a KeyTemplate that generates an AES-CTR-HMAC-AEAD key with the following parameters: |
| 120 | // - AES key size: 16 bytes |
| 121 | // - AES CTR IV size: 16 bytes |
| 122 | // - HMAC key size: 32 bytes |
| 123 | // - HMAC tag size: 16 bytes |
| 124 | // - HMAC hash function: SHA256 |
| 125 | func AES128CTRHMACSHA256KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES128CTRHMACSHA256KeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 126 | return createAESCTRHMACAEADKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESCTRHMACAEADKeyTemplate().(16, 16, 32, 16, commonpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/common_go_proto`/.HashType_SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/common_go_proto`/HashType_SHA256.) |
| 127 | } |
| 128 | |
| 129 | // AES256CTRHMACSHA256KeyTemplate is a KeyTemplate that generates an AES-CTR-HMAC-AEAD key with the following parameters: |
| 130 | // - AES key size: 32 bytes |
| 131 | // - AES CTR IV size: 16 bytes |
| 132 | // - HMAC key size: 32 bytes |
| 133 | // - HMAC tag size: 32 bytes |
| 134 | // - HMAC hash function: SHA256 |
| 135 | func AES256CTRHMACSHA256KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES256CTRHMACSHA256KeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 136 | return createAESCTRHMACAEADKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESCTRHMACAEADKeyTemplate().(32, 16, 32, 32, commonpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/common_go_proto`/.HashType_SHA256scip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/common_go_proto`/HashType_SHA256.) |
| 137 | } |
| 138 | |
| 139 | // ChaCha20Poly1305KeyTemplate is a KeyTemplate that generates a CHACHA20_POLY1305 key. |
| 140 | func ChaCha20Poly1305KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/ChaCha20Poly1305KeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 141 | return &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#{ |
| 142 | // Don't set value because KeyFormat is not required. |
| 143 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: chaCha20Poly1305TypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/chaCha20Poly1305TypeURL., |
| 144 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#OutputPrefixType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK., |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | // XChaCha20Poly1305KeyTemplate is a KeyTemplate that generates a XCHACHA20_POLY1305 key. |
| 149 | func XChaCha20Poly1305KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/XChaCha20Poly1305KeyTemplate().() *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 150 | return &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#{ |
| 151 | // Don't set value because KeyFormat is not required. |
| 152 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: xChaCha20Poly1305TypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/xChaCha20Poly1305TypeURL., |
| 153 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#OutputPrefixType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK., |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | // CreateKMSEnvelopeAEADKeyTemplate returns a key template that generates a |
| 158 | // KMSEnvelopeAEAD key for a given key encryption key (KEK) in a remote key |
| 159 | // management service (KMS). |
| 160 | // |
| 161 | // When performing encrypt operations, a data encryption key (DEK) is generated |
| 162 | // for each ciphertext. The DEK is wrapped by the remote KMS using the KEK and |
| 163 | // stored alongside the ciphertext. |
| 164 | // |
| 165 | // dekTemplate must be a KeyTemplate for any of these Tink AEAD key types (any |
| 166 | // other key template will be rejected): |
| 167 | // - AesCtrHmacAeadKey |
| 168 | // - AesGcmKey |
| 169 | // - ChaCha20Poly1305Key |
| 170 | // - XChaCha20Poly1305 |
| 171 | // - AesGcmSivKey |
| 172 | // |
| 173 | // DEKs generated by this key template use the RAW output prefix to make them |
| 174 | // compatible with remote KMS encrypt/decrypt operations. |
| 175 | // |
| 176 | // Unlike other templates, when you generate new keys with this template, Tink |
| 177 | // does not generate new key material, but only creates a reference to the |
| 178 | // remote KEK. |
| 179 | // |
| 180 | // If either uri or dekTemplate contain invalid input, an error is returned. |
| 181 | // |
| 182 | // It is often not necessary to use this function. Instead, you can call |
| 183 | // kmsClient.GetAEAD to get a remote AEAD, and create an envelope AEAD using |
| 184 | // [NewKMSEnvelopeAEAD2]. |
| 185 | // |
| 186 | // There is no need to call registry.RegisterKMSClient anymore. |
| 187 | func CreateKMSEnvelopeAEADKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/CreateKMSEnvelopeAEADKeyTemplate().(uri string, dekTemplate *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#) (*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#, error) { |
| 188 | if !isSupportedKMSEnvelopeDEKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/isSupportedKMSEnvelopeDEK().(dekTemplate.GetTypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#GetTypeUrl().()) { |
| 189 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().("unsupported DEK key type %s. Only Tink AEAD key types are supported", dekTemplate.GetTypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#GetTypeUrl().()) |
| 190 | } |
| 191 | |
| 192 | f := &kmsenvpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/kms_envelope_go_proto`/.KmsEnvelopeAeadKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/kms_envelope_go_proto`/KmsEnvelopeAeadKeyFormat#{ |
| 193 | KekUriscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/kms_envelope_go_proto`/KmsEnvelopeAeadKeyFormat#KekUri.: uri, |
| 194 | DekTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/kms_envelope_go_proto`/KmsEnvelopeAeadKeyFormat#DekTemplate.: dekTemplate, |
| 195 | } |
| 196 | serializedFormat, err := protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/.Marshalscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/Marshal().(f) |
| 197 | if err != nil { |
| 198 | return nil, fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Errorf().("failed to marshal key format: %s", err) |
| 199 | } |
| 200 | return &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#{ |
| 201 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: serializedFormat, |
| 202 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: kmsEnvelopeAEADTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/kmsEnvelopeAEADTypeURL., |
| 203 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#OutputPrefixType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_RAWscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_RAW., |
| 204 | }, nil |
| 205 | } |
| 206 | |
| 207 | // KMSEnvelopeAEADKeyTemplate returns a KeyTemplate that generates a |
| 208 | // KMSEnvelopeAEAD key for a given key encryption key (KEK) in a remote key |
| 209 | // management service (KMS). |
| 210 | // |
| 211 | // If either uri or dekTemplate contain invalid input, program execution will |
| 212 | // be interrupted. |
| 213 | // |
| 214 | // Deprecated: Use [CreateKMSEnvelopeAEADKeyTemplate], which returns an error |
| 215 | // value instead of interrupting the program. |
| 216 | func KMSEnvelopeAEADKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/KMSEnvelopeAEADKeyTemplate().(uri string, dekTemplate *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#) *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 217 | t, err := CreateKMSEnvelopeAEADKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/CreateKMSEnvelopeAEADKeyTemplate().(uri, dekTemplate) |
| 218 | if err != nil { |
| 219 | tinkerrorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/.Failscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/Fail().(err.Error()) |
| 220 | } |
| 221 | return t |
| 222 | } |
| 223 | |
| 224 | // createAESGCMKeyTemplate creates a new AES-GCM key template with the given key |
| 225 | // size in bytes. |
| 226 | func createAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESGCMKeyTemplate().(keySize uint32, outputPrefixType tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType#) *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 227 | format := &gcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_go_proto`/.AesGcmKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_go_proto`/AesGcmKeyFormat#{ |
| 228 | KeySizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_go_proto`/AesGcmKeyFormat#KeySize.: keySize, |
| 229 | } |
| 230 | serializedFormat, err := protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/.Marshalscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/Marshal().(format) |
| 231 | if err != nil { |
| 232 | tinkerrorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/.Failscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/Fail().(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("failed to marshal key format: %s", err)) |
| 233 | } |
| 234 | return &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#{ |
| 235 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: aesGCMTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/aesGCMTypeURL., |
| 236 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: serializedFormat, |
| 237 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#OutputPrefixType.: outputPrefixType, |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | // createXAESGCMKeyTemplate creates a new X-AES-GCM key template with the given |
| 242 | // salt size in bytes. |
| 243 | func createXAESGCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createXAESGCMKeyTemplate().(saltSize uint32, outputPrefixType tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType#) *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 244 | format := &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKeyFormat#{ |
| 245 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKeyFormat#Params.: &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmParams#{ |
| 246 | SaltSizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmParams#SaltSize.: saltSize, |
| 247 | }, |
| 248 | } |
| 249 | serializedFormat, err := protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/.Marshalscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/Marshal().(format) |
| 250 | if err != nil { |
| 251 | tinkerrorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/.Failscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/Fail().(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("failed to marshal key format: %s", err)) |
| 252 | } |
| 253 | return &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#{ |
| 254 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: xAESGCMTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/xAESGCMTypeURL., |
| 255 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: serializedFormat, |
| 256 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#OutputPrefixType.: outputPrefixType, |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | // createAESGCMSIVKeyTemplate creates a new AES-GCM-SIV key template with the given key |
| 261 | // size in bytes. |
| 262 | func createAESGCMSIVKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESGCMSIVKeyTemplate().(keySize uint32, outputPrefixType tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType#) *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 263 | format := &gcmsivpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_siv_go_proto`/.AesGcmSivKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_siv_go_proto`/AesGcmSivKeyFormat#{ |
| 264 | KeySizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_gcm_siv_go_proto`/AesGcmSivKeyFormat#KeySize.: keySize, |
| 265 | } |
| 266 | serializedFormat, err := protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/.Marshalscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/Marshal().(format) |
| 267 | if err != nil { |
| 268 | tinkerrorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/.Failscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/Fail().(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("failed to marshal key format: %s", err)) |
| 269 | } |
| 270 | return &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#{ |
| 271 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: aesGCMSIVTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/aesGCMSIVTypeURL., |
| 272 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: serializedFormat, |
| 273 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#OutputPrefixType.: outputPrefixType, |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | func createAESCTRHMACAEADKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/createAESCTRHMACAEADKeyTemplate().(aesKeySize, ivSize, hmacKeySize, tagSize uint32, hash commonpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/common_go_proto`/.HashTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/common_go_proto`/HashType#) *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate# { |
| 278 | format := &ctrhmacpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_hmac_aead_go_proto`/.AesCtrHmacAeadKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_hmac_aead_go_proto`/AesCtrHmacAeadKeyFormat#{ |
| 279 | AesCtrKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_hmac_aead_go_proto`/AesCtrHmacAeadKeyFormat#AesCtrKeyFormat.: &ctrpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/.AesCtrKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/AesCtrKeyFormat#{ |
| 280 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/AesCtrKeyFormat#Params.: &ctrpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/.AesCtrParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/AesCtrParams#{IvSizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/AesCtrParams#IvSize.: ivSize}, |
| 281 | KeySizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_go_proto`/AesCtrKeyFormat#KeySize.: aesKeySize, |
| 282 | }, |
| 283 | HmacKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/aes_ctr_hmac_aead_go_proto`/AesCtrHmacAeadKeyFormat#HmacKeyFormat.: &hmacpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/.HmacKeyFormatscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/HmacKeyFormat#{ |
| 284 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/HmacKeyFormat#Params.: &hmacpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/.HmacParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/HmacParams#{Hashscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/HmacParams#Hash.: hash, TagSizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/HmacParams#TagSize.: tagSize}, |
| 285 | KeySizescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/hmac_go_proto`/HmacKeyFormat#KeySize.: hmacKeySize, |
| 286 | }, |
| 287 | } |
| 288 | serializedFormat, err := protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/.Marshalscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/Marshal().(format) |
| 289 | if err != nil { |
| 290 | tinkerrorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/.Failscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/tinkerror`/Fail().(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("failed to marshal key format: %s", err)) |
| 291 | } |
| 292 | return &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#{ |
| 293 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: serializedFormat, |
| 294 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: aesCTRHMACAEADTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/aesCTRHMACAEADTypeURL., |
| 295 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#OutputPrefixType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_TINKscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_TINK., |
| 296 | } |
| 297 | } |