func makeUSIGKeyFingerprint(pubKey interface{}) (fingerprint usigKeyFingerprint, err error) {
	pubKeyBytes, err := x509.MarshalPKIXPublicKey(pubKey)
	if err != nil {
		return usigKeyFingerprint{}, err
	}
	pubKeyHash := sha256.Sum256(pubKeyBytes)
	copy(fingerprint[:], pubKeyHash[:])
	return fingerprint, nil
}
makeUSIGKeyFingerprint calculates USIG fingerprint from a serialized
USIG public key.
package authenticator
import (
	"crypto"
	"crypto/ecdsa"
	"crypto/rand"
	"crypto/sha256"
	"crypto/x509"
	"encoding/asn1"
	"fmt"
	"math/big"
	"sync"
	"github.com/hyperledger-labs/minbft/usig"
	sgxusig "github.com/hyperledger-labs/minbft/usig/sgx"
)
type SignatureCipher interface {
	Sign(md []byte, privKey interface{}) ([]byte, error)
	Verify(md, sig []byte, pubKey interface{}) bool
}
type (
	EcdsaNIST256pSigCipher struct{}
)
type EcdsaSigCipher EcdsaNIST256pSigCipher
var _ = SignatureCipher(&EcdsaSigCipher{})
type ecdsaSignature struct {
	R, S *big.Int
}
func (c *EcdsaSigCipher) Sign(md []byte, privKey interface{}) ([]byte, error) {
	if eccPrivKey, ok := privKey.(*ecdsa.PrivateKey); ok {
		r, s, err := ecdsa.Sign(rand.Reader, eccPrivKey, md)
		if err != nil {
			return nil, fmt.Errorf("ECDSA signing error: %v", err)
		}
		sig, err := asn1.Marshal(ecdsaSignature{r, s})
		if err != nil {
			return nil, fmt.Errorf("ECDSA signature ASN1-DER marshal error: %v", err)
		}
		return sig, nil
	}
	return nil, fmt.Errorf("incompatible format of ECDSA private key")
}
func (c *EcdsaSigCipher) Verify(md, sig []byte, pubKey interface{}) bool {
	ecdsaSig := &ecdsaSignature{}
	_, err := asn1.Unmarshal(sig, ecdsaSig)
	if err != nil {
		panic(fmt.Sprintf("ECDSA signature is not ASN.1-DER encoded: %v", err))
	}
	if ecdsaPubKey, ok := pubKey.(*ecdsa.PublicKey); ok {
		return ecdsa.Verify(ecdsaPubKey, md, ecdsaSig.R, ecdsaSig.S)
	}
	return false
}
type AuthenticationScheme interface {
	GenerateAuthenticationTag(m []byte, privKey interface{}) ([]byte, error)
	VerifyAuthenticationTag(m []byte, sig []byte, pubKey interface{}) error
}
type PublicAuthenScheme struct {
	HashScheme crypto.Hash
	SigCipher  SignatureCipher
}
var _ AuthenticationScheme = (*PublicAuthenScheme)(nil)
func (a *PublicAuthenScheme) GenerateAuthenticationTag(m []byte, privKey interface{}) ([]byte, error) {
	md := a.HashScheme.New().Sum(m)
	return a.SigCipher.Sign(md, privKey)
}
func (a *PublicAuthenScheme) VerifyAuthenticationTag(m []byte, sig []byte, pubKey interface{}) error {
	md := a.HashScheme.New().Sum(m)
	if !a.SigCipher.Verify(md, sig, pubKey) {
		return fmt.Errorf("invalid signature")
	}
	return nil
}
type usigKeyFingerprint [8]byte