INNER CODE UNIT · Go

signWithBioRetry

go-piv/piv-go · v2/piv/bio_integration_test.go:186

func signWithBioRetry(t *testing.T, signer crypto.Signer, message []byte) {
	const maxAttempts = 3
	digest := sha256.Sum256(message)
	for attempt := 1; attempt <= maxAttempts; attempt++ {
		sig, err := signer.Sign(rand.Reader, digest[:], crypto.SHA256)
		if err != nil {
			if isUnsupportedMatchPolicy(err) {
				t.Skipf("match policy not supported: %v", err)
			}
			var authErr AuthErr
			if errors.As(err, &authErr) {
				if attempt == maxAttempts {
					t.Fatalf("signing failed after %d attempts: %v", attempt, err)
				}
				continue
			}
			t.Fatalf("signing failed: %v", err)
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…