INNER CODE UNIT · Go

getPublicKeyFromSlot

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

func getPublicKeyFromSlot(yk *YubiKey) (crypto.PublicKey, error) {
	cert, err := yk.Certificate(SlotAuthentication)
	if err == nil {
		return cert.PublicKey, nil
	}
	attest, err := yk.Attest(SlotAuthentication)
	if err != nil {
		return nil, fmt.Errorf("no cert or attestation: %w", err)
	}
	return attest.PublicKey, nil
}

func requireBioTests(t *testing.T) {
	if !canModifyYubiKey {
		t.Skip("not running test that accesses yubikey, provide --wipe-yubikey flag")
	}
	if os.Getenv("PIV_BIO_TESTS") == "" {
		t.Skip("set PIV_BIO_TESTS=1 to run biometric integration tests")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…