neo-go/pkg/interop/crypto/crypto.go

23 lines
839 B
Go
Raw Normal View History

2020-05-18 07:58:27 +00:00
/*
Package crypto provides an interface to cryptographic syscalls.
*/
package crypto
import (
"github.com/nspcc-dev/neo-go/pkg/interop"
"github.com/nspcc-dev/neo-go/pkg/interop/neogointernal"
)
// CheckMultisig checks that the script container (transaction) is signed by multiple
// ECDSA keys at once. It uses `System.Crypto.CheckMultisig` syscall.
func CheckMultisig(pubs []interop.PublicKey, sigs []interop.Signature) bool {
return neogointernal.Syscall2("System.Crypto.CheckMultisig", pubs, sigs).(bool)
}
// CheckSig checks that sig is a correct signature of the script container
// (transaction) for the given pub (serialized public key). It uses
// `System.Crypto.CheckSig` syscall.
2021-03-04 17:56:54 +00:00
func CheckSig(pub interop.PublicKey, sig interop.Signature) bool {
return neogointernal.Syscall2("System.Crypto.CheckSig", pub, sig).(bool)
2021-03-04 17:56:54 +00:00
}