| 1 | // Copyright 2022 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 keyderivation_testscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/ |
| 16 | |
| 17 | import ( |
| 18 | "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/" |
| 19 | "reflectscip-go gomod github.com/golang/go/src go1.24.0 reflect/" |
| 20 | "slicesscip-go gomod github.com/golang/go/src go1.24.0 slices/" |
| 21 | "testingscip-go gomod github.com/golang/go/src go1.24.0 testing/" |
| 22 | |
| 23 | "github.com/google/go-cmp/cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/" |
| 24 | "google.golang.org/protobuf/protoscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/proto`/" |
| 25 | "google.golang.org/protobuf/testing/protocmpscip-go gomod google.golang.org/protobuf v1.36.8 `google.golang.org/protobuf/testing/protocmp`/" |
| 26 | "github.com/tink-crypto/tink-go/v2/aeadscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/" |
| 27 | "github.com/tink-crypto/tink-go/v2/core/registryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/core/registry`/" |
| 28 | "github.com/tink-crypto/tink-go/v2/internal/configscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/" |
| 29 | "github.com/tink-crypto/tink-go/v2/internal/internalapiscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/" |
| 30 | "github.com/tink-crypto/tink-go/v2/internal/primitiveregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/" |
| 31 | "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`/" |
| 32 | "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`/" |
| 33 | "github.com/tink-crypto/tink-go/v2/keyderivation/internal/keyderiverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation/internal/keyderiver`/" |
| 34 | "github.com/tink-crypto/tink-go/v2/keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/" |
| 35 | "github.com/tink-crypto/tink-go/v2/keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/" |
| 36 | "github.com/tink-crypto/tink-go/v2/testkeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/" |
| 37 | "github.com/tink-crypto/tink-go/v2/testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/" |
| 38 | 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`/" |
| 39 | ) |
| 40 | |
| 41 | // invalidDeriver returns two keys, but wrappedKeysetDeriver accepts only one. |
| 42 | type invalidDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/invalidDeriver# struct{} |
| 43 | |
| 44 | var _ keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.KeysetDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/KeysetDeriver# = (*invalidDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/invalidDeriver#)(nil) |
| 45 | |
| 46 | func (i *invalidDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/invalidDeriver#) DeriveKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/invalidDeriver#DeriveKeyset().(salt []byte) (*keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Handle#, error) { |
| 47 | manager := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewManager().() |
| 48 | keyID, err := manager.Addscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Add().(aeadscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/.AES128GCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES128GCMKeyTemplate().()) |
| 49 | if err != nil { |
| 50 | return nil, err |
| 51 | } |
| 52 | manager.SetPrimaryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#SetPrimary().(keyID) |
| 53 | if _, err = manager.Addscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Add().(aeadscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/.AES256GCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES256GCMKeyTemplate().()); err != nil { |
| 54 | return nil, err |
| 55 | } |
| 56 | return manager.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Handle().() |
| 57 | } |
| 58 | |
| 59 | func TestNewWrappedKeysetDeriverWrongPrimitiveFailsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestNewWrappedKeysetDeriverWrongPrimitiveFails().(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#) { |
| 60 | handle, err := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewHandlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewHandle().(aeadscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/.AES128GCMKeyTemplatescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/aead`/AES128GCMKeyTemplate().()) |
| 61 | if err != nil { |
| 62 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keyset.NewHandle() err = %v, want nil", err) |
| 63 | } |
| 64 | if _, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.Newscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/New().(handle); err == nil { |
| 65 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keyderivation.New() err = nil, want non-nil") |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | func TestNilKeysetHandlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestNilKeysetHandle().(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#) { |
| 70 | if _, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.Newscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/New().(nil); err == nil { |
| 71 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keyderivation.New(nil) err = nil, want error") |
| 72 | } |
| 73 | if _, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.Newscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/New().(&keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Handle#{}); err == nil { |
| 74 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keyderivation.New(&keyset.Handle{}) err = nil, want error") |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | func TestNewWithConfigEmptyOrNilKeySetHandlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestNewWithConfigEmptyOrNilKeySetHandle().(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#) { |
| 79 | c := configscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/.NewBuilderscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/NewBuilder().().Buildscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/Builder#Build().() |
| 80 | if _, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.NewWithConfigscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/NewWithConfig().(nil, &c); err == nil { |
| 81 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keyderivation.NewWithConfig(nil) err = nil, want error") |
| 82 | } |
| 83 | if _, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.NewWithConfigscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/NewWithConfig().(&keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Handle#{}, &c); err == nil { |
| 84 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keyderivation.NewWithConfig(&keyset.Handle{}) err = nil, want error") |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | const ( |
| 89 | stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL. = "type.googleapis.com/google.crypto.tink.StubKeysetDeriver" |
| 90 | ) |
| 91 | |
| 92 | type stubKeysetDeriverParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverParams# struct{} |
| 93 | |
| 94 | var _ 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# = (*stubKeysetDeriverParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverParams#)(nil) |
| 95 | |
| 96 | func (p *stubKeysetDeriverParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverParams#) Equalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverParams#Equal().(_ 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#) bool { return true } |
| 97 | func (p *stubKeysetDeriverParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverParams#) HasIDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverParams#HasIDRequirement().() bool { return true } |
| 98 | |
| 99 | type stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey# struct { |
| 100 | prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#prefixType. 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# |
| 101 | idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#idRequirement. uint32 |
| 102 | } |
| 103 | |
| 104 | var _ keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key# = (*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#)(nil) |
| 105 | |
| 106 | func (p *stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#) Equalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#Equal().(_ keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#) bool { return true } |
| 107 | func (p *stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#) Parametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#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# { return &stubKeysetDeriverParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverParams#{} } |
| 108 | func (p *stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#) IDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#IDRequirement().() (uint32, bool) { |
| 109 | return p.idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#idRequirement., p.HasIDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#HasIDRequirement().() |
| 110 | } |
| 111 | func (p *stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#) HasIDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#HasIDRequirement().() bool { |
| 112 | return p.prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#prefixType. != 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. |
| 113 | } |
| 114 | |
| 115 | type stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization# struct{} |
| 116 | |
| 117 | var _ protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.KeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerializer# = (*stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#)(nil) |
| 118 | |
| 119 | func (s *stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#) SerializeKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#SerializeKey().(key keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#) (*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#, error) { |
| 120 | return 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().( |
| 121 | &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#{ |
| 122 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., |
| 123 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("serialized_key"), |
| 124 | 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., |
| 125 | }, |
| 126 | key.(*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#).prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#prefixType., |
| 127 | key.(*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#).idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#idRequirement., |
| 128 | ) |
| 129 | } |
| 130 | |
| 131 | type stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser# struct{} |
| 132 | |
| 133 | var _ protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.KeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeyParser# = (*stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#)(nil) |
| 134 | |
| 135 | func (s *stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#) ParseKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#ParseKey().(serialization *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#) (keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#, error) { |
| 136 | idRequirement, _ := serialization.IDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerialization#IDRequirement().() |
| 137 | return &stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{ |
| 138 | prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#prefixType.: serialization.OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerialization#OutputPrefixType().(), |
| 139 | idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#idRequirement.: idRequirement, |
| 140 | }, nil |
| 141 | } |
| 142 | |
| 143 | const ( |
| 144 | derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL. = "type.googleapis.com/google.crypto.tink.DerivedKey" |
| 145 | ) |
| 146 | |
| 147 | type derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey# struct { |
| 148 | prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#prefixType. 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# |
| 149 | idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#idRequirement. uint32 |
| 150 | valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#value. []byte |
| 151 | } |
| 152 | |
| 153 | var _ keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key# = (*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#)(nil) |
| 154 | |
| 155 | func (p *derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#) Equalscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#Equal().(_ keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#) bool { return true } |
| 156 | func (p *derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#) Parametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#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# { return &stubKeysetDeriverParamsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverParams#{} } |
| 157 | func (p *derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#) IDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#IDRequirement().() (uint32, bool) { |
| 158 | return p.idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#idRequirement., p.HasIDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#HasIDRequirement().() |
| 159 | } |
| 160 | func (p *derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#) HasIDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#HasIDRequirement().() bool { |
| 161 | return p.prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#prefixType. != 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. |
| 162 | } |
| 163 | |
| 164 | type stubLegacyKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubLegacyKeyDeriver# struct{} |
| 165 | |
| 166 | var _ keyderiverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation/internal/keyderiver`/.KeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation/internal/keyderiver`/KeyDeriver# = (*stubLegacyKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubLegacyKeyDeriver#)(nil) |
| 167 | |
| 168 | func (s *stubLegacyKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubLegacyKeyDeriver#) DeriveKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubLegacyKeyDeriver#DeriveKey().(salt []byte) (keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#, error) { |
| 169 | return &derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#{ |
| 170 | valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#value.: slicesscip-go gomod github.com/golang/go/src go1.24.0 slices/.Concatscip-go gomod github.com/golang/go/src go1.24.0 slices/Concat().(salt, []byte("_raw_derived_key")), |
| 171 | prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#prefixType.: 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., |
| 172 | idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#idRequirement.: 0, |
| 173 | }, nil |
| 174 | } |
| 175 | |
| 176 | type derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer# struct{} |
| 177 | |
| 178 | var _ protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.KeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerializer# = (*derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#)(nil) |
| 179 | |
| 180 | func (s *derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#) SerializeKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#SerializeKey().(key keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#) (*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#, error) { |
| 181 | return 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().( |
| 182 | &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#{ |
| 183 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 184 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: key.(*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#).valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#value., |
| 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 | }, |
| 187 | key.(*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#).prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#prefixType., |
| 188 | key.(*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#).idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#idRequirement., |
| 189 | ) |
| 190 | } |
| 191 | |
| 192 | type derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser# struct{} |
| 193 | |
| 194 | var _ protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.KeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeyParser# = (*derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#)(nil) |
| 195 | |
| 196 | func (s *derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#) ParseKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#ParseKey().(serialization *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#) (keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#, error) { |
| 197 | idRequirement, _ := serialization.IDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerialization#IDRequirement().() |
| 198 | return &derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#{ |
| 199 | prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#prefixType.: serialization.OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerialization#OutputPrefixType().(), |
| 200 | idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#idRequirement.: idRequirement, |
| 201 | valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#value.: serialization.KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/KeySerialization#KeyData().().GetValuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#GetValue().(), |
| 202 | }, nil |
| 203 | } |
| 204 | |
| 205 | type stubKeyDeriverKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager# struct{} |
| 206 | |
| 207 | var _ registryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/core/registry`/.KeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/core/registry`/KeyManager# = (*stubKeyDeriverKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#)(nil) |
| 208 | |
| 209 | func (km *stubKeyDeriverKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#) NewKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#NewKey().(_ []byte) (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#, error) { |
| 210 | 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().("not implemented") |
| 211 | } |
| 212 | func (km *stubKeyDeriverKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#) NewKeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#NewKeyData().(_ []byte) (*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#, error) { |
| 213 | 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().("not implemented") |
| 214 | } |
| 215 | func (km *stubKeyDeriverKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#) DoesSupportscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#DoesSupport().(keyURL string) bool { |
| 216 | return keyURL == stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL. |
| 217 | } |
| 218 | func (km *stubKeyDeriverKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#) TypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#TypeURL().() string { return stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL. } |
| 219 | func (km *stubKeyDeriverKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#) Primitivescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#Primitive().(_ []byte) (any, error) { |
| 220 | return &stubLegacyKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubLegacyKeyDeriver#{}, nil |
| 221 | } |
| 222 | |
| 223 | func TestPrimitiveFactory_New_FailsIfNoKeyManagerRegisteredscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestPrimitiveFactory_New_FailsIfNoKeyManagerRegistered().(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#) { |
| 224 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL.) |
| 225 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 226 | |
| 227 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., &stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#{}); err != nil { |
| 228 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 229 | } |
| 230 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](&stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#{}); err != nil { |
| 231 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 232 | } |
| 233 | |
| 234 | // Create a keyset with a single key. |
| 235 | km := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewManager().() |
| 236 | keyID, err := km.AddKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKey().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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., 0x1234}) |
| 237 | if err != nil { |
| 238 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKey() err = %v, want nil", err) |
| 239 | } |
| 240 | if err := km.SetPrimaryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#SetPrimary().(keyID); err != nil { |
| 241 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.SetPrimary() err = %v, want nil", err) |
| 242 | } |
| 243 | handle, err := km.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Handle().() |
| 244 | if err != nil { |
| 245 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.Handle() err = %v, want nil", err) |
| 246 | } |
| 247 | |
| 248 | if _, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.Newscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/New().(handle); err == nil { |
| 249 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keyderivation.New() err = nil, want non-nil") |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | func TestPrimitiveFactory_UsesRawPrimitivesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestPrimitiveFactory_UsesRawPrimitives().(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#) { |
| 254 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL.) |
| 255 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 256 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL.) |
| 257 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#]() |
| 258 | defer registryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/core/registry`/.UnregisterKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/core/registry`/UnregisterKeyManager().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., internalapiscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/.Tokenscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/Token#{}) |
| 259 | |
| 260 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., &stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#{}); err != nil { |
| 261 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 262 | } |
| 263 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](&stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#{}); err != nil { |
| 264 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 265 | } |
| 266 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., &derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#{}); err != nil { |
| 267 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 268 | } |
| 269 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#](&derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#{}); err != nil { |
| 270 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 271 | } |
| 272 | // Register the key manager. |
| 273 | if err := registryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/core/registry`/.RegisterKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/core/registry`/RegisterKeyManager().(&stubKeyDeriverKeyManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeyDeriverKeyManager#{}); err != nil { |
| 274 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("registry.RegisterKeyManager() err = %v, want nil", err) |
| 275 | } |
| 276 | |
| 277 | for _, tc := range []struct { |
| 278 | name string |
| 279 | key *stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey# |
| 280 | wantKeyset *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset# |
| 281 | }{ |
| 282 | { |
| 283 | name: "TINK", |
| 284 | key: &stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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., 0x1234}, |
| 285 | wantKeyset: testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/.NewKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/NewKeyset().(0x1234, []*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keyset_Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#{ |
| 286 | { |
| 287 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 288 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 289 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_raw_derived_key"), |
| 290 | 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., |
| 291 | }, |
| 292 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 293 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x1234, |
| 294 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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., |
| 295 | }, |
| 296 | }), |
| 297 | }, |
| 298 | { |
| 299 | name: "RAW", |
| 300 | key: &stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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}, |
| 301 | wantKeyset: testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/.NewKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/NewKeyset().(0x12345678, []*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keyset_Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#{ |
| 302 | { |
| 303 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 304 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 305 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_raw_derived_key"), |
| 306 | 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., |
| 307 | }, |
| 308 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 309 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x12345678, |
| 310 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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., |
| 311 | }, |
| 312 | }), |
| 313 | }, |
| 314 | { |
| 315 | name: "CRUNCHY", |
| 316 | key: &stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_CRUNCHYscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_CRUNCHY., 0x1234}, |
| 317 | wantKeyset: testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/.NewKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/NewKeyset().(0x1234, []*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keyset_Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#{ |
| 318 | { |
| 319 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 320 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 321 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_raw_derived_key"), |
| 322 | 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., |
| 323 | }, |
| 324 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 325 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x1234, |
| 326 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#OutputPrefixType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_CRUNCHYscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_CRUNCHY., |
| 327 | }, |
| 328 | }), |
| 329 | }, |
| 330 | } { |
| 331 | 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#) { |
| 332 | // Create a keyset with a single key. |
| 333 | km := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewManager().() |
| 334 | |
| 335 | var opts []keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.KeyOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/KeyOpts# |
| 336 | if !tc.key.HasIDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#HasIDRequirement().() { |
| 337 | opts = append(opts, keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.WithFixedIDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/WithFixedID().(0x12345678)) |
| 338 | } |
| 339 | |
| 340 | keyID, err := km.AddKeyWithOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKeyWithOpts().(tc.key, internalapiscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/.Tokenscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/Token#{}, opts...) |
| 341 | if err != nil { |
| 342 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKeyWithOpts() err = %v, want nil", err) |
| 343 | } |
| 344 | if err := km.SetPrimaryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#SetPrimary().(keyID); err != nil { |
| 345 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.SetPrimary() err = %v, want nil", err) |
| 346 | } |
| 347 | handle, err := km.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Handle().() |
| 348 | if err != nil { |
| 349 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.Handle() err = %v, want nil", err) |
| 350 | } |
| 351 | |
| 352 | keysetDeriver, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.Newscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/New().(handle) |
| 353 | if err != nil { |
| 354 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keyderivation.New() err = %v, want nil", err) |
| 355 | } |
| 356 | |
| 357 | gotHandle, err := keysetDeriver.DeriveKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/KeysetDeriver#DeriveKeyset.([]byte("a_very_unique_salt")) |
| 358 | if err != nil { |
| 359 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keysetDeriver.DeriveKeyset() err = %v, want nil", err) |
| 360 | } |
| 361 | got := testkeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/.KeysetMaterialscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/KeysetMaterial().(gotHandle) |
| 362 | 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.wantKeyset, 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 != "" { |
| 363 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keysetDeriver.DeriveKeyset() returned unexpected diff (-want +got):\n%s", diff) |
| 364 | } |
| 365 | }) |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | type fullKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver# struct { |
| 370 | kscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#k. *stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey# |
| 371 | } |
| 372 | |
| 373 | func (s *fullKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#) DeriveKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#DeriveKey().(salt []byte) (keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#, error) { |
| 374 | return &derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#{ |
| 375 | valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#value.: slicesscip-go gomod github.com/golang/go/src go1.24.0 slices/.Concatscip-go gomod github.com/golang/go/src go1.24.0 slices/Concat().(salt, []byte("_full_derived_key")), |
| 376 | prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#prefixType.: s.kscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#k..prefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#prefixType., |
| 377 | idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#idRequirement.: s.kscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#k..idRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#idRequirement., |
| 378 | }, nil |
| 379 | } |
| 380 | |
| 381 | func TestPrimitiveFactory_UsesFullPrimitivesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestPrimitiveFactory_UsesFullPrimitives().(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#) { |
| 382 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL.) |
| 383 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 384 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL.) |
| 385 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#]() |
| 386 | defer primitiveregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/.UnregisterPrimitiveConstructorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/UnregisterPrimitiveConstructor().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 387 | |
| 388 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., &stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#{}); err != nil { |
| 389 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 390 | } |
| 391 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](&stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#{}); err != nil { |
| 392 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 393 | } |
| 394 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., &derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#{}); err != nil { |
| 395 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 396 | } |
| 397 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#](&derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#{}); err != nil { |
| 398 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 399 | } |
| 400 | |
| 401 | if err := primitiveregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/.RegisterPrimitiveConstructorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/RegisterPrimitiveConstructor().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](func(k keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#) (any, error) { |
| 402 | that, ok := k.(*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#) |
| 403 | if !ok { |
| 404 | 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().("key is not a stubKeysetDeriverKey") |
| 405 | } |
| 406 | return &fullKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#{kscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#k.: that}, nil |
| 407 | }); err != nil { |
| 408 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("primitiveregistry.RegisterPrimitiveConstructor() err = %v, want nil", err) |
| 409 | } |
| 410 | |
| 411 | for _, tc := range []struct { |
| 412 | name string |
| 413 | key *stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey# |
| 414 | wantKeyset *tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset# |
| 415 | }{ |
| 416 | { |
| 417 | name: "TINK", |
| 418 | key: &stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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., 0x1234}, |
| 419 | wantKeyset: testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/.NewKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/NewKeyset().(0x1234, []*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keyset_Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#{ |
| 420 | { |
| 421 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 422 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 423 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_full_derived_key"), |
| 424 | 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., |
| 425 | }, |
| 426 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 427 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x1234, |
| 428 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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., |
| 429 | }, |
| 430 | }), |
| 431 | }, |
| 432 | { |
| 433 | name: "RAW", |
| 434 | key: &stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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}, |
| 435 | wantKeyset: testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/.NewKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/NewKeyset().(0x12345678, []*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keyset_Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#{ |
| 436 | { |
| 437 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 438 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 439 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_full_derived_key"), |
| 440 | 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., |
| 441 | }, |
| 442 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 443 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x12345678, |
| 444 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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., |
| 445 | }, |
| 446 | }), |
| 447 | }, |
| 448 | { |
| 449 | name: "CRUNCHY", |
| 450 | key: &stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_CRUNCHYscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_CRUNCHY., 0x1234}, |
| 451 | wantKeyset: testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/.NewKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/NewKeyset().(0x1234, []*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keyset_Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#{ |
| 452 | { |
| 453 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 454 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 455 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_full_derived_key"), |
| 456 | 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., |
| 457 | }, |
| 458 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 459 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x1234, |
| 460 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#OutputPrefixType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_CRUNCHYscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_CRUNCHY., |
| 461 | }, |
| 462 | }), |
| 463 | }, |
| 464 | } { |
| 465 | 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#) { |
| 466 | // Create a keyset with a single key. |
| 467 | km := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewManager().() |
| 468 | |
| 469 | var opts []keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.KeyOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/KeyOpts# |
| 470 | if !tc.key.HasIDRequirementscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#HasIDRequirement().() { |
| 471 | opts = append(opts, keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.WithFixedIDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/WithFixedID().(0x12345678)) |
| 472 | } |
| 473 | |
| 474 | keyID, err := km.AddKeyWithOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKeyWithOpts().(tc.key, internalapiscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/.Tokenscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/Token#{}, opts...) |
| 475 | if err != nil { |
| 476 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKeyWithOpts() err = %v, want nil", err) |
| 477 | } |
| 478 | if err := km.SetPrimaryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#SetPrimary().(keyID); err != nil { |
| 479 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.SetPrimary() err = %v, want nil", err) |
| 480 | } |
| 481 | handle, err := km.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Handle().() |
| 482 | if err != nil { |
| 483 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.Handle() err = %v, want nil", err) |
| 484 | } |
| 485 | |
| 486 | keysetDeriver, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.Newscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/New().(handle) |
| 487 | if err != nil { |
| 488 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keyderivation.New() err = %v, want nil", err) |
| 489 | } |
| 490 | |
| 491 | gotHandle, err := keysetDeriver.DeriveKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/KeysetDeriver#DeriveKeyset.([]byte("a_very_unique_salt")) |
| 492 | if err != nil { |
| 493 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keysetDeriver.DeriveKeyset() err = %v, want nil", err) |
| 494 | } |
| 495 | got := testkeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/.KeysetMaterialscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/KeysetMaterial().(gotHandle) |
| 496 | |
| 497 | 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.wantKeyset, 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 != "" { |
| 498 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keysetDeriver.DeriveKeyset() returned unexpected diff (-want +got):\n%s", diff) |
| 499 | } |
| 500 | }) |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | func TestPrimitiveFactory_MultipleKeys_UsesFullPrimitivesscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestPrimitiveFactory_MultipleKeys_UsesFullPrimitives().(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#) { |
| 505 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL.) |
| 506 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 507 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL.) |
| 508 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#]() |
| 509 | defer primitiveregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/.UnregisterPrimitiveConstructorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/UnregisterPrimitiveConstructor().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 510 | |
| 511 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., &stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#{}); err != nil { |
| 512 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 513 | } |
| 514 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](&stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#{}); err != nil { |
| 515 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 516 | } |
| 517 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., &derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#{}); err != nil { |
| 518 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 519 | } |
| 520 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#](&derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#{}); err != nil { |
| 521 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 522 | } |
| 523 | |
| 524 | if err := primitiveregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/.RegisterPrimitiveConstructorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/RegisterPrimitiveConstructor().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](func(k keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#) (any, error) { |
| 525 | that, ok := k.(*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#) |
| 526 | if !ok { |
| 527 | 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().("key is not a stubKeysetDeriverKey") |
| 528 | } |
| 529 | return &fullKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#{kscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#k.: that}, nil |
| 530 | }); err != nil { |
| 531 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("primitiveregistry.RegisterPrimitiveConstructor() err = %v, want nil", err) |
| 532 | } |
| 533 | |
| 534 | km := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewManager().() |
| 535 | |
| 536 | keyID, err := km.AddKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKey().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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., 0x1234}) |
| 537 | if err != nil { |
| 538 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKey() err = %v, want nil", err) |
| 539 | } |
| 540 | if err := km.SetPrimaryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#SetPrimary().(keyID); err != nil { |
| 541 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.SetPrimary() err = %v, want nil", err) |
| 542 | } |
| 543 | if _, err := km.AddKeyWithOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKeyWithOpts().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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., 0x2222}, internalapiscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/.Tokenscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/Token#{}, keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.WithStatusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/WithStatus().(keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.Disabledscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Disabled.)); err != nil { |
| 544 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKeyWithOpts() err = %v, want nil", err) |
| 545 | } |
| 546 | if _, err := km.AddKeyWithOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKeyWithOpts().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_CRUNCHYscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_CRUNCHY., 0x2345}, internalapiscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/.Tokenscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/Token#{}, keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.WithStatusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/WithStatus().(keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.Enabledscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Enabled.)); err != nil { |
| 547 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKeyWithOpts() err = %v, want nil", err) |
| 548 | } |
| 549 | if _, err := km.AddKeyWithOptsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKeyWithOpts().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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}, internalapiscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/.Tokenscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/Token#{}, keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.WithStatusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/WithStatus().(keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.Destroyedscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Destroyed.)); err != nil { |
| 550 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKeyWithOpts() err = %v, want nil", err) |
| 551 | } |
| 552 | |
| 553 | handle, err := km.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Handle().() |
| 554 | if err != nil { |
| 555 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.Handle() err = %v, want nil", err) |
| 556 | } |
| 557 | |
| 558 | keysetDeriver, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.Newscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/New().(handle) |
| 559 | if err != nil { |
| 560 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keyderivation.New() err = %v, want nil", err) |
| 561 | } |
| 562 | |
| 563 | gotHandle, err := keysetDeriver.DeriveKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/KeysetDeriver#DeriveKeyset.([]byte("a_very_unique_salt")) |
| 564 | if err != nil { |
| 565 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keysetDeriver.DeriveKeyset() err = %v, want nil", err) |
| 566 | } |
| 567 | got := testkeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/.KeysetMaterialscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/KeysetMaterial().(gotHandle) |
| 568 | |
| 569 | // Only the enabled keys are in the derived keyset. |
| 570 | want := testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/.NewKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/NewKeyset().(0x1234, []*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keyset_Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#{ |
| 571 | { |
| 572 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 573 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 574 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_full_derived_key"), |
| 575 | 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., |
| 576 | }, |
| 577 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 578 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x1234, |
| 579 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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., |
| 580 | }, |
| 581 | { |
| 582 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 583 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 584 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_full_derived_key"), |
| 585 | 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., |
| 586 | }, |
| 587 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 588 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x2345, |
| 589 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#OutputPrefixType.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.OutputPrefixType_CRUNCHYscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/OutputPrefixType_CRUNCHY., |
| 590 | }, |
| 591 | }) |
| 592 | 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().(want, 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 != "" { |
| 593 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keysetDeriver.DeriveKeyset() returned unexpected diff (-want +got):\n%s", diff) |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | type failingKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/failingKeyDeriver# struct{} |
| 598 | |
| 599 | func (s *failingKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/failingKeyDeriver#) DeriveKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/failingKeyDeriver#DeriveKey().(salt []byte) (keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#, error) { |
| 600 | 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().("failingKeyDeriver.DeriveKey() failed") |
| 601 | } |
| 602 | |
| 603 | func TestPrimitiveFactory_KeysetDeriverFailsIfFullPrimitiveFailsscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestPrimitiveFactory_KeysetDeriverFailsIfFullPrimitiveFails().(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#) { |
| 604 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL.) |
| 605 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 606 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL.) |
| 607 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#]() |
| 608 | defer primitiveregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/.UnregisterPrimitiveConstructorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/UnregisterPrimitiveConstructor().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 609 | |
| 610 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., &stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#{}); err != nil { |
| 611 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 612 | } |
| 613 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](&stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#{}); err != nil { |
| 614 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 615 | } |
| 616 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., &derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#{}); err != nil { |
| 617 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 618 | } |
| 619 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#](&derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#{}); err != nil { |
| 620 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 621 | } |
| 622 | |
| 623 | if err := primitiveregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/.RegisterPrimitiveConstructorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/primitiveregistry`/RegisterPrimitiveConstructor().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](func(k keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#) (any, error) { |
| 624 | return &failingKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/failingKeyDeriver#{}, nil |
| 625 | }); err != nil { |
| 626 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("primitiveregistry.RegisterPrimitiveConstructor() err = %v, want nil", err) |
| 627 | } |
| 628 | |
| 629 | // Create a keyset with a single key. |
| 630 | km := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewManager().() |
| 631 | keyID, err := km.AddKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKey().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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}) |
| 632 | if err != nil { |
| 633 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKey() err = %v, want nil", err) |
| 634 | } |
| 635 | if err := km.SetPrimaryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#SetPrimary().(keyID); err != nil { |
| 636 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.SetPrimary() err = %v, want nil", err) |
| 637 | } |
| 638 | handle, err := km.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Handle().() |
| 639 | if err != nil { |
| 640 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.Handle() err = %v, want nil", err) |
| 641 | } |
| 642 | |
| 643 | keysetDeriver, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.Newscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/New().(handle) |
| 644 | if err != nil { |
| 645 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keyderivation.New() err = %v, want nil", err) |
| 646 | } |
| 647 | |
| 648 | if _, err := keysetDeriver.DeriveKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/KeysetDeriver#DeriveKeyset.([]byte("a_very_unique_salt")); err == nil { |
| 649 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keysetDeriver.DeriveKeyset() err = %v, want nil", err) |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | func TestNewWithConfigFailsIfNoPrimitiveConstructorRegisteredscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestNewWithConfigFailsIfNoPrimitiveConstructorRegistered().(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#) { |
| 654 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL.) |
| 655 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 656 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL.) |
| 657 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#]() |
| 658 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., &stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#{}); err != nil { |
| 659 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 660 | } |
| 661 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](&stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#{}); err != nil { |
| 662 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 663 | } |
| 664 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., &derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#{}); err != nil { |
| 665 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 666 | } |
| 667 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#](&derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#{}); err != nil { |
| 668 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 669 | } |
| 670 | |
| 671 | km := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewManager().() |
| 672 | keyID, err := km.AddKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKey().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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., 0x1234}) |
| 673 | if err != nil { |
| 674 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKey() err = %v, want nil", err) |
| 675 | } |
| 676 | if err := km.SetPrimaryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#SetPrimary().(keyID); err != nil { |
| 677 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.SetPrimary() err = %v, want nil", err) |
| 678 | } |
| 679 | handle, err := km.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Handle().() |
| 680 | if err != nil { |
| 681 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.Handle() err = %v, want nil", err) |
| 682 | } |
| 683 | c := configscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/.NewBuilderscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/NewBuilder().().Buildscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/Builder#Build().() |
| 684 | |
| 685 | if _, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.NewWithConfigscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/NewWithConfig().(handle, &c); err == nil { |
| 686 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("keyderivation.NewWithConfig() err = nil, want error") |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | func TestNewWithConfigscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/TestNewWithConfig().(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#) { |
| 691 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL.) |
| 692 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#]() |
| 693 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL.) |
| 694 | defer protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.UnregisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/UnregisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#]() |
| 695 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(stubKeysetDeriverURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverURL., &stubKeysetDeriverKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeyParser#{}); err != nil { |
| 696 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 697 | } |
| 698 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#](&stubKeysetDeriverKeySerializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKeySerialization#{}); err != nil { |
| 699 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 700 | } |
| 701 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., &derivedKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyParser#{}); err != nil { |
| 702 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeyParser() err = %v, want nil", err) |
| 703 | } |
| 704 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*derivedKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKey#](&derivedKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeySerializer#{}); err != nil { |
| 705 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("protoserialization.RegisterKeySerializer() err = %v, want nil", err) |
| 706 | } |
| 707 | |
| 708 | primitiveConstructor := func(k keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/.Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/key`/Key#) (any, error) { |
| 709 | that, ok := k.(*stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#) |
| 710 | if !ok { |
| 711 | 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().("key is not a stubKeysetDeriverKey") |
| 712 | } |
| 713 | return &fullKeyDeriverscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#{kscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/fullKeyDeriver#k.: that}, nil |
| 714 | } |
| 715 | builder := configscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/.NewBuilderscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/NewBuilder().() |
| 716 | if err := builder.RegisterPrimitiveConstructorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/Builder#RegisterPrimitiveConstructor().(reflectscip-go gomod github.com/golang/go/src go1.24.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.24.0 reflect/TypeOf().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{}), primitiveConstructor, internalapiscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/.Tokenscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/internalapi`/Token#{}); err != nil { |
| 717 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("builder.RegisterPrimitiveConstructor() err = %v, want nil", err) |
| 718 | } |
| 719 | c := builder.Buildscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/config`/Builder#Build().() |
| 720 | |
| 721 | km := keysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/.NewManagerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/NewManager().() |
| 722 | keyID, err := km.AddKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#AddKey().(&stubKeysetDeriverKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/stubKeysetDeriverKey#{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., 0x1234}) |
| 723 | if err != nil { |
| 724 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.AddKey() err = %v, want nil", err) |
| 725 | } |
| 726 | if err := km.SetPrimaryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#SetPrimary().(keyID); err != nil { |
| 727 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.SetPrimary() err = %v, want nil", err) |
| 728 | } |
| 729 | handle, err := km.Handlescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyset`/Manager#Handle().() |
| 730 | if err != nil { |
| 731 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("km.Handle() err = %v, want nil", err) |
| 732 | } |
| 733 | |
| 734 | deriver, err := keyderivationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/.NewWithConfigscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/NewWithConfig().(handle, &c) |
| 735 | if err != nil { |
| 736 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("keyderivation.NewWithConfig() err = %v, want nil", err) |
| 737 | } |
| 738 | gotHandle, err := deriver.DeriveKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation`/KeysetDeriver#DeriveKeyset.([]byte("a_very_unique_salt")) |
| 739 | if err != nil { |
| 740 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Fatalf().("deriver.DeriveKeyset() err = %v, want nil", err) |
| 741 | } |
| 742 | |
| 743 | wantKeyset := testutilscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/.NewKeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testutil`/NewKeyset().(0x1234, []*tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.Keyset_Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#{ |
| 744 | { |
| 745 | KeyDatascip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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#{ |
| 746 | TypeUrlscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#TypeUrl.: derivedKeyURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/keyderivation_test`/derivedKeyURL., |
| 747 | Valuescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyData#Value.: []byte("a_very_unique_salt_full_derived_key"), |
| 748 | 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., |
| 749 | }, |
| 750 | Statusscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#Status.: tinkpbscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/.KeyStatusType_ENABLEDscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/KeyStatusType_ENABLED., |
| 751 | KeyIdscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#KeyId.: 0x1234, |
| 752 | OutputPrefixTypescip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/proto/tink_go_proto`/Keyset_Key#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., |
| 753 | }, |
| 754 | }) |
| 755 | got := testkeysetscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/.KeysetMaterialscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/testkeyset`/KeysetMaterial().(gotHandle) |
| 756 | 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().(wantKeyset, 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 != "" { |
| 757 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("deriver.DeriveKeyset() returned unexpected diff (-want +got):\n%s", diff) |
| 758 | } |
| 759 | } |