tutus-chain/pkg/interop/crypto/crypto.go

23 lines
849 B
Go

/*
Package crypto provides an interface to cryptographic syscalls.
*/
package crypto
import (
"github.com/tutus-one/tutus-chain/pkg/interop"
"github.com/tutus-one/tutus-chain/pkg/interop/tutusinternal"
)
// 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 tutusinternal.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.
func CheckSig(pub interop.PublicKey, sig interop.Signature) bool {
return tutusinternal.Syscall2("System.Crypto.CheckSig", pub, sig).(bool)
}