@@ -47,6 +47,7 @@ func (ev *envelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
4747 // If *any* signature is found to be incorrect, it is skipped
4848 var acceptedKeys []AcceptedKey
4949 usedKeyids := make (map [string ]string )
50+ unverified_providers := ev .providers
5051 for _ , s := range e .Signatures {
5152 sig , err := b64Decode (s .Sig )
5253 if err != nil {
@@ -57,7 +58,8 @@ func (ev *envelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
5758 // If provider and signature include key IDs but do not match skip.
5859 // If a provider recognizes the key, we exit
5960 // the loop and use the result.
60- for _ , v := range ev .providers {
61+ providers := unverified_providers
62+ for i , v := range providers {
6163 keyID , err := v .KeyID ()
6264
6365 // 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) {
8284 KeyID : keyID ,
8385 Sig : s ,
8486 }
87+ unverified_providers = RemoveIndex (providers , i )
8588
8689 // See https://github.com/in-toto/in-toto/pull/251
8790 if _ , ok := usedKeyids [keyID ]; ok {
@@ -133,3 +136,7 @@ func SHA256KeyID(pub crypto.PublicKey) (string, error) {
133136 fingerprint := ssh .FingerprintSHA256 (sshpk )
134137 return fingerprint , nil
135138}
139+
140+ func RemoveIndex (v []Verifier , index int ) []Verifier {
141+ return append (v [:index ], v [index + 1 :]... )
142+ }
0 commit comments