| 1 | // Copyright 2024 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 xaesgcm_testscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/ |
| 16 | |
| 17 | import ( |
| 18 | "testingscip-go gomod github.com/golang/go/src go1.24.0 testing/" |
| 19 | |
| 20 | "github.com/google/go-cmp/cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/" |
| 21 | "google.golang.org/protobuf/protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/" |
| 22 | "google.golang.org/protobuf/testing/protocmpscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/testing/protocmp`/" |
| 23 | "github.com/tink-crypto/tink-go/v2/aead/xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/" |
| 24 | "github.com/tink-crypto/tink-go/v2/insecuresecretdataaccessscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/insecuresecretdataaccess`/" |
| 25 | "github.com/tink-crypto/tink-go/v2/internal/protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/" |
| 26 | "github.com/tink-crypto/tink-go/v2/keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/" |
| 27 | "github.com/tink-crypto/tink-go/v2/secretdatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/secretdata`/" |
| 28 | 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`/" |
| 29 | 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`/" |
| 30 | ) |
| 31 | |
| 32 | func mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#, message protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/Message#) []byte { |
| 33 | t.Helperscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Helper().() |
| 34 | serializedMessage, 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().(message) |
| 35 | if err != nil { |
| 36 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("proto.Marshal(%v) err = %v, want nil", message, err) |
| 37 | } |
| 38 | return serializedMessage |
| 39 | } |
| 40 | |
| 41 | func TestParseKeyFailsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/TestParseKeyFails().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 42 | validXAESGCMKey := &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#{ |
| 43 | Versionscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#Version.: 0, |
| 44 | KeyValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#KeyValue.: []byte("12345678901234561234567890123456"), |
| 45 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#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#{ |
| 46 | 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.: 12, |
| 47 | }, |
| 48 | } |
| 49 | for _, tc := range []struct { |
| 50 | name string |
| 51 | keyData *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData# |
| 52 | 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# |
| 53 | keyID uint32 |
| 54 | }{ |
| 55 | { |
| 56 | name: "invalid key size", |
| 57 | keyData: &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 58 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 59 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#{ |
| 60 | Versionscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#Version.: 0, |
| 61 | KeyValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#KeyValue.: []byte("0123"), |
| 62 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#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#{ |
| 63 | 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.: 12, |
| 64 | }, |
| 65 | }), |
| 66 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 67 | }, |
| 68 | 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., |
| 69 | keyID: 0x11223344, |
| 70 | }, |
| 71 | { |
| 72 | name: "invalid salt length", |
| 73 | keyData: &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 74 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 75 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#{ |
| 76 | Versionscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#Version.: 0, |
| 77 | KeyValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#KeyValue.: []byte("12345678901234561234567890123456"), |
| 78 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#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#{ |
| 79 | 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.: 16, |
| 80 | }, |
| 81 | }), |
| 82 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 83 | }, |
| 84 | 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., |
| 85 | keyID: 0x11223344, |
| 86 | }, |
| 87 | { |
| 88 | name: "invalid key proto serialization", |
| 89 | keyData: &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 90 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 91 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("invalid proto"), |
| 92 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 93 | }, |
| 94 | 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., |
| 95 | keyID: 0x11223344, |
| 96 | }, |
| 97 | { |
| 98 | name: "invalid key version", |
| 99 | keyData: &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 100 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 101 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#{ |
| 102 | Versionscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#Version.: 1, |
| 103 | KeyValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#KeyValue.: []byte("12345678901234561234567890123456"), |
| 104 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#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#{ |
| 105 | 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.: 12, |
| 106 | }, |
| 107 | }), |
| 108 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 109 | }, |
| 110 | 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., |
| 111 | keyID: 0x11223344, |
| 112 | }, |
| 113 | { |
| 114 | name: "invalid key material type", |
| 115 | keyData: &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 116 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 117 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, validXAESGCMKey), |
| 118 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_ASYMMETRIC_PRIVATEscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_ASYMMETRIC_PRIVATE., |
| 119 | }, |
| 120 | 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., |
| 121 | keyID: 0x11223344, |
| 122 | }, |
| 123 | { |
| 124 | name: "invalid output prefix type", |
| 125 | keyData: &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 126 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 127 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, validXAESGCMKey), |
| 128 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 129 | }, |
| 130 | outputPrefixType: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_UNKNOWN_PREFIXscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_UNKNOWN_PREFIX., |
| 131 | keyID: 0x11223344, |
| 132 | }, |
| 133 | } { |
| 134 | t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 135 | keySerialization, err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.NewKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/NewKeySerialization().(tc.keyData, tc.outputPrefixType, tc.keyID) |
| 136 | if err != nil { |
| 137 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.NewKeySerialization(%v, %v, %v) err = %v, want nil", tc.keyData, tc.outputPrefixType, tc.keyID, err) |
| 138 | } |
| 139 | if _, err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.ParseKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/ParseKey().(keySerialization); err == nil { |
| 140 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("protoserialization.ParseKey(%v) err = nil, want non-nil", keySerialization) |
| 141 | } |
| 142 | }) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | func mustCreateKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeySerialization().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#, keyData *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#, 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#, idRequirement uint32) *protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.KeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerialization# { |
| 147 | t.Helperscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Helper().() |
| 148 | ks, err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.NewKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/NewKeySerialization().(keyData, outputPrefixType, idRequirement) |
| 149 | if err != nil { |
| 150 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.NewKeySerialization(%v, %v, %v) err = %v, want nil", keyData, outputPrefixType, idRequirement, err) |
| 151 | } |
| 152 | return ks |
| 153 | } |
| 154 | |
| 155 | func mustCreateKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKey().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#, keyValue []byte, variant xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.Variantscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/Variant#, saltSize int, idRequirement uint32) *xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/Key# { |
| 156 | t.Helperscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Helper().() |
| 157 | params, err := xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/NewParameters().(variant, saltSize) |
| 158 | if err != nil { |
| 159 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("xaesgcm.NewParameters(%v, %v) err = %v, want nil", variant, saltSize, err) |
| 160 | } |
| 161 | keyMaterial := secretdatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/secretdata`/.NewBytesFromDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/secretdata`/NewBytesFromData().(keyValue, insecuresecretdataaccessscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/insecuresecretdataaccess`/.Tokenscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/insecuresecretdataaccess`/Token#{}) |
| 162 | key, err := xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.NewKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/NewKey().(keyMaterial, idRequirement, params) |
| 163 | if err != nil { |
| 164 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("xaesgcm.NewKey(keyMaterial, %v, params) err = %v, want nil", idRequirement, err) |
| 165 | } |
| 166 | return key |
| 167 | } |
| 168 | |
| 169 | func TestParseKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/TestParseKey().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 170 | for _, tc := range []struct { |
| 171 | name string |
| 172 | keySerialization *protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.KeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerialization# |
| 173 | wantKey *xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/Key# |
| 174 | }{ |
| 175 | { |
| 176 | name: "TINK output prefix type", |
| 177 | keySerialization: mustCreateKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeySerialization().(t, &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 178 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 179 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#{ |
| 180 | KeyValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#KeyValue.: []byte("12345678901234561234567890123456"), |
| 181 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#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#{ |
| 182 | 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.: 12, |
| 183 | }, |
| 184 | }), |
| 185 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 186 | }, 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., 0x11223344), |
| 187 | wantKey: mustCreateKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKey().(t, []byte("12345678901234561234567890123456"), xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantTinkscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantTink., 12, 0x11223344), |
| 188 | }, |
| 189 | { |
| 190 | name: "RAW output prefix type", |
| 191 | keySerialization: mustCreateKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeySerialization().(t, &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 192 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 193 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#{ |
| 194 | KeyValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#KeyValue.: []byte("12345678901234561234567890123456"), |
| 195 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#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#{ |
| 196 | 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.: 12, |
| 197 | }, |
| 198 | }), |
| 199 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 200 | }, 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., 0), |
| 201 | wantKey: mustCreateKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKey().(t, []byte("12345678901234561234567890123456"), xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantNoPrefixscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantNoPrefix., 12, 0), |
| 202 | }, |
| 203 | } { |
| 204 | t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 205 | gotKey, err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.ParseKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/ParseKey().(tc.keySerialization) |
| 206 | if err != nil { |
| 207 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.ParseKey(%v) err = %v, want nil", tc.keySerialization, err) |
| 208 | } |
| 209 | if diff := cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(gotKey, tc.wantKey); diff != "" { |
| 210 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("protoserialization.ParseKey(%v) returned unexpected diff (-want +got):\n%s", tc.keySerialization, diff) |
| 211 | } |
| 212 | }) |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | func TestSerializeKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/TestSerializeKey().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 217 | keyValue := []byte("12345678901234561234567890123456") |
| 218 | for _, tc := range []struct { |
| 219 | name string |
| 220 | key *xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/Key# |
| 221 | wantKeySerialization *protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.KeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerialization# |
| 222 | }{ |
| 223 | { |
| 224 | name: "key with TINK output prefix type", |
| 225 | key: mustCreateKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKey().(t, keyValue, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantTinkscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantTink., 12, 0x11223344), |
| 226 | wantKeySerialization: mustCreateKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeySerialization().(t, &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 227 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 228 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#{ |
| 229 | KeyValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#KeyValue.: keyValue, |
| 230 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#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#{ |
| 231 | 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.: 12, |
| 232 | }, |
| 233 | }), |
| 234 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 235 | }, 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., 0x11223344), |
| 236 | }, |
| 237 | { |
| 238 | name: "key with RAW output prefix type", |
| 239 | key: mustCreateKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKey().(t, keyValue, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantNoPrefixscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantNoPrefix., 12, 0x00), |
| 240 | wantKeySerialization: mustCreateKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeySerialization().(t, &tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#{ |
| 241 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 242 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, &xaesgcmpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/.XAesGcmKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#{ |
| 243 | KeyValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#KeyValue.: keyValue, |
| 244 | Paramsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKey#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#{ |
| 245 | 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.: 12, |
| 246 | }, |
| 247 | }), |
| 248 | KeyMaterialTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#KeyMaterialType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyData_SYMMETRICscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData_SYMMETRIC., |
| 249 | }, 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., 0), |
| 250 | }, |
| 251 | } { |
| 252 | t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 253 | got, err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.SerializeKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/SerializeKey().(tc.key) |
| 254 | if err != nil { |
| 255 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.SerializeKey(&testKey{}) err = %v, want nil", err) |
| 256 | } |
| 257 | if diff := cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(got, tc.wantKeySerialization); diff != "" { |
| 258 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("protoserialization.SerializeKey(%v) returned unexpected diff (-want +got):\n%s", tc.key, diff) |
| 259 | } |
| 260 | }) |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | func mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#, 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#, saltSize uint32) *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# { |
| 265 | t.Helperscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Helper().() |
| 266 | 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#{ |
| 267 | 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#{ |
| 268 | 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, |
| 269 | }, |
| 270 | } |
| 271 | 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#{ |
| 272 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 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 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: mustMarshalProtoscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshalProto().(t, format), |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | func mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#, variant xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.Variantscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/Variant#, saltSize int) *xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.Parametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/Parameters# { |
| 279 | t.Helperscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Helper().() |
| 280 | params, err := xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.NewParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/NewParameters().(variant, saltSize) |
| 281 | if err != nil { |
| 282 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("xaesgcm.NewParameters(%v, %v) err = %v, want nil", variant, saltSize, err) |
| 283 | } |
| 284 | return params |
| 285 | } |
| 286 | |
| 287 | func TestSerializeParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/TestSerializeParameters().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 288 | for _, tc := range []struct { |
| 289 | name string |
| 290 | parameters keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Parametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Parameters# |
| 291 | 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# |
| 292 | }{ |
| 293 | { |
| 294 | name: "TINK-SaltSize:12", |
| 295 | parameters: mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantTinkscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantTink., 12), |
| 296 | keyTemplate: mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t, 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., 12), |
| 297 | }, |
| 298 | { |
| 299 | name: "TINK-SaltSize:8", |
| 300 | parameters: mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantTinkscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantTink., 8), |
| 301 | keyTemplate: mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t, 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., 8), |
| 302 | }, |
| 303 | { |
| 304 | name: "RAW-SaltSize:12", |
| 305 | parameters: mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantNoPrefixscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantNoPrefix., 12), |
| 306 | keyTemplate: mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t, 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., 12), |
| 307 | }, |
| 308 | { |
| 309 | name: "RAW-SaltSize:8", |
| 310 | parameters: mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantNoPrefixscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantNoPrefix., 8), |
| 311 | keyTemplate: mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t, 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., 8), |
| 312 | }, |
| 313 | } { |
| 314 | t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 315 | got, err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.SerializeParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/SerializeParameters().(tc.parameters) |
| 316 | if err != nil { |
| 317 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.SerializeParameters(%v) err = %v, want nil", tc.parameters, err) |
| 318 | } |
| 319 | if diff := cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(tc.keyTemplate, got, protocmpscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/testing/protocmp`/.Transformscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/testing/protocmp`/Transform().()); diff != "" { |
| 320 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("protoserialization.SerializeParameters(%v) returned unexpected diff (-want +got):\n%s", tc.parameters, diff) |
| 321 | } |
| 322 | }) |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | func TestParseParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/TestParseParameters().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 327 | for _, tc := range []struct { |
| 328 | name string |
| 329 | parameters keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Parametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Parameters# |
| 330 | 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# |
| 331 | }{ |
| 332 | { |
| 333 | name: "TINK-SaltSize:12", |
| 334 | parameters: mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantTinkscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantTink., 12), |
| 335 | keyTemplate: mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t, 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., 12), |
| 336 | }, |
| 337 | { |
| 338 | name: "TINK-SaltSize:8", |
| 339 | parameters: mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantTinkscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantTink., 8), |
| 340 | keyTemplate: mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t, 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., 8), |
| 341 | }, |
| 342 | { |
| 343 | name: "RAW-SaltSize:12", |
| 344 | parameters: mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantNoPrefixscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantNoPrefix., 12), |
| 345 | keyTemplate: mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t, 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., 12), |
| 346 | }, |
| 347 | { |
| 348 | name: "RAW-SaltSize:8", |
| 349 | parameters: mustCreateParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateParameters().(t, xaesgcmscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/.VariantNoPrefixscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm`/VariantNoPrefix., 8), |
| 350 | keyTemplate: mustCreateKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustCreateKeyTemplate().(t, 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., 8), |
| 351 | }, |
| 352 | } { |
| 353 | t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 354 | got, err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.ParseParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/ParseParameters().(tc.keyTemplate) |
| 355 | if err != nil { |
| 356 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.ParseParameters(%v) err = %v, want nil", tc.keyTemplate, err) |
| 357 | } |
| 358 | if diff := cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(tc.parameters, got); diff != "" { |
| 359 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("protoserialization.ParseParameters(%v) returned unexpected diff (-want +got):\n%s", tc.keyTemplate, diff) |
| 360 | } |
| 361 | }) |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | func mustMarshalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshal().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#, message protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/Message#) []byte { |
| 366 | t.Helperscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Helper().() |
| 367 | serializedMessage, 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().(message) |
| 368 | if err != nil { |
| 369 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("proto.Marshal(%v) err = %v, want nil", message, err) |
| 370 | } |
| 371 | return serializedMessage |
| 372 | } |
| 373 | |
| 374 | func TestParseParametersFailsWithWrongKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/TestParseParametersFailsWithWrongKeyTemplate().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 375 | for _, tc := range []struct { |
| 376 | name string |
| 377 | 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# |
| 378 | }{ |
| 379 | { |
| 380 | name: "empty", |
| 381 | 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#{}, |
| 382 | }, |
| 383 | { |
| 384 | name: "empty format", |
| 385 | 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#{ |
| 386 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 387 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: mustMarshalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshal().(t, &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#{}), |
| 388 | 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., |
| 389 | }, |
| 390 | }, |
| 391 | { |
| 392 | name: "invalid format type", |
| 393 | 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#{ |
| 394 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 395 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: []byte("invalid format"), |
| 396 | 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., |
| 397 | }, |
| 398 | }, |
| 399 | { |
| 400 | name: "wrong type URL", |
| 401 | 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#{ |
| 402 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: "type.googleapis.com/google.crypto.tink.AesCtrHmacAeadKey", |
| 403 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: mustMarshalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshal().(t, &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#{ |
| 404 | 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#{ |
| 405 | 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.: 8, |
| 406 | }, |
| 407 | }), |
| 408 | 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., |
| 409 | }, |
| 410 | }, |
| 411 | { |
| 412 | name: "invalid version", |
| 413 | 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#{ |
| 414 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 415 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: mustMarshalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshal().(t, &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#{ |
| 416 | 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#{ |
| 417 | 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.: 8, |
| 418 | }, |
| 419 | Versionscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/x_aes_gcm_go_proto`/XAesGcmKeyFormat#Version.: 1, |
| 420 | }), |
| 421 | 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., |
| 422 | }, |
| 423 | }, |
| 424 | { |
| 425 | name: "invalid salt size", |
| 426 | 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#{ |
| 427 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 428 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: mustMarshalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshal().(t, &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#{ |
| 429 | 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#{ |
| 430 | 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.: 2, |
| 431 | }, |
| 432 | }), |
| 433 | 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., |
| 434 | }, |
| 435 | }, |
| 436 | { |
| 437 | name: "unknown output prefix type", |
| 438 | 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#{ |
| 439 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 440 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: mustMarshalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshal().(t, &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#{ |
| 441 | 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#{ |
| 442 | 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.: 8, |
| 443 | }, |
| 444 | }), |
| 445 | 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_UNKNOWN_PREFIXscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_UNKNOWN_PREFIX., |
| 446 | }, |
| 447 | }, |
| 448 | { |
| 449 | name: "unsupported output prefix type", |
| 450 | 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#{ |
| 451 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#TypeUrl.: "type.googleapis.com/google.crypto.tink.XAesGcmKey", |
| 452 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyTemplate#Value.: mustMarshalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead/xaesgcm_test`/mustMarshal().(t, &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#{ |
| 453 | 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#{ |
| 454 | 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.: 8, |
| 455 | }, |
| 456 | }), |
| 457 | 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_LEGACYscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_LEGACY., |
| 458 | }, |
| 459 | }, |
| 460 | } { |
| 461 | t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 462 | if _, err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.ParseParametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/ParseParameters().(tc.keyTemplate); err == nil { |
| 463 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("protoserialization.ParseParameters(%v) err = nil, want error", tc.keyTemplate) |
| 464 | } |
| 465 | }) |
| 466 | } |
| 467 | } |