2020-05-18 10:58:27 +03:00
|
|
|
/*
|
|
|
|
Package crypto provides an interface to cryptographic syscalls.
|
|
|
|
*/
|
2018-08-22 10:12:57 +02:00
|
|
|
package crypto
|
|
|
|
|
2021-02-05 19:02:09 +03:00
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/neogointernal"
|
|
|
|
)
|
2020-08-28 10:47:15 +03:00
|
|
|
|
2021-03-09 18:11:21 +03:00
|
|
|
// CheckMultisig checks that script container (transaction) is signed by multiple
|
2021-05-11 17:13:33 +03:00
|
|
|
// ECDSA keys at once. It uses `System.Crypto.CheckMultisig` syscall.
|
2021-03-09 18:11:21 +03:00
|
|
|
func CheckMultisig(pubs []interop.PublicKey, sigs []interop.Signature) bool {
|
2021-05-11 17:13:33 +03:00
|
|
|
return neogointernal.Syscall2("System.Crypto.CheckMultisig", pubs, sigs).(bool)
|
2020-07-14 12:09:26 +03:00
|
|
|
}
|
|
|
|
|
2021-03-09 18:11:21 +03:00
|
|
|
// CheckSig checks that sig is correct signature of the script container
|
|
|
|
// (transaction) for a given pub (serialized public key). It uses
|
2021-05-11 16:32:09 +03:00
|
|
|
// `System.Crypto.CheckSig` syscall.
|
2021-03-04 20:56:54 +03:00
|
|
|
func CheckSig(pub interop.PublicKey, sig interop.Signature) bool {
|
2021-05-11 16:32:09 +03:00
|
|
|
return neogointernal.Syscall2("System.Crypto.CheckSig", pub, sig).(bool)
|
2021-03-04 20:56:54 +03:00
|
|
|
}
|