Exemplo n.º 1
0
func verifySigEd25519(hash, sig, pub []byte) (bool, error) {
	pubKeyBytes := new([32]byte)
	copy(pubKeyBytes[:], pub)
	sigBytes := new([64]byte)
	copy(sigBytes[:], sig)
	res := ed25519.Verify(pubKeyBytes, hash, sigBytes)
	return res, nil
}
Exemplo n.º 2
0
// TODO: Consider returning a reason for failure, or logging a runtime type mismatch.
func (pubKey PubKeyEd25519) VerifyBytes(msg []byte, sig_ Signature) bool {
	sig, ok := sig_.(SignatureEd25519)
	if !ok {
		return false
	}
	pubKeyBytes := [32]byte(pubKey)
	sigBytes := [64]byte(sig)
	return ed25519.Verify(&pubKeyBytes, msg, &sigBytes)
}