@@ -47,6 +47,7 @@ func (ev *envelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
47
47
// If *any* signature is found to be incorrect, it is skipped
48
48
var acceptedKeys []AcceptedKey
49
49
usedKeyids := make (map [string ]string )
50
+ unverified_providers := ev .providers
50
51
for _ , s := range e .Signatures {
51
52
sig , err := b64Decode (s .Sig )
52
53
if err != nil {
@@ -57,7 +58,8 @@ func (ev *envelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
57
58
// If provider and signature include key IDs but do not match skip.
58
59
// If a provider recognizes the key, we exit
59
60
// the loop and use the result.
60
- for _ , v := range ev .providers {
61
+ providers := unverified_providers
62
+ for i , v := range providers {
61
63
keyID , err := v .KeyID ()
62
64
63
65
// Verifiers that do not provide a keyid will be generated one using public.
@@ -82,6 +84,7 @@ func (ev *envelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
82
84
KeyID : keyID ,
83
85
Sig : s ,
84
86
}
87
+ unverified_providers = RemoveIndex (providers , i )
85
88
86
89
// See https://github.com/in-toto/in-toto/pull/251
87
90
if _ , ok := usedKeyids [keyID ]; ok {
@@ -133,3 +136,7 @@ func SHA256KeyID(pub crypto.PublicKey) (string, error) {
133
136
fingerprint := ssh .FingerprintSHA256 (sshpk )
134
137
return fingerprint , nil
135
138
}
139
+
140
+ func RemoveIndex (v []Verifier , index int ) []Verifier {
141
+ return append (v [:index ], v [index + 1 :]... )
142
+ }
0 commit comments