mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-05 03:58:23 +00:00
compiler: add public key recovering syscalls
Added Secp256r1Recover and Secp256k1Recover syscalls.
This commit is contained in:
parent
0b87a68210
commit
4f1cf07075
2 changed files with 25 additions and 1 deletions
|
@ -11,6 +11,10 @@ var syscalls = map[string]map[string]string{
|
|||
"GetUsage": "Neo.Attribute.GetUsage",
|
||||
"GetData": "Neo.Attribute.GetData",
|
||||
},
|
||||
"crypto": {
|
||||
"Secp256k1Recover": "Neo.Cryptography.Secp256k1Recover",
|
||||
"Secp256r1Recover": "Neo.Cryptography.Secp256r1Recover",
|
||||
},
|
||||
"enumerator": {
|
||||
"Concat": "Neo.Enumerator.Concat",
|
||||
"Create": "Neo.Enumerator.Create",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Package crypto provides an interface to VM cryptographic instructions.
|
||||
Package crypto provides an interface to VM cryptographic instructions and syscalls.
|
||||
*/
|
||||
package crypto
|
||||
|
||||
|
@ -30,3 +30,23 @@ func Hash256(b []byte) []byte {
|
|||
func VerifySignature(msg []byte, sig []byte, pub []byte) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Secp256k1Recover recovers public key from the given signature (r, s) on the
|
||||
// given message hash using Secp256k1 elliptic curve. Flag isEven denotes Y's
|
||||
// least significant bit in decompression algorithm. The return value is byte
|
||||
// array representation of the public key which is either empty (if it's not
|
||||
// possible to recover key) or contains 32 bytes in BE for X point (in case of
|
||||
// success). This function uses Neo.Cryptography.Secp256k1Recover syscall.
|
||||
func Secp256k1Recover(r []byte, s []byte, messageHash []byte, isEven bool) []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Secp256r1Recover recovers public key from the given signature (r, s) on the
|
||||
// given message hash using Secp256r1 elliptic curve. Flag isEven denotes Y's
|
||||
// least significant bit in decompression algorithm. The return value is byte
|
||||
// array representation of the public key which is either empty (if it's not
|
||||
// possible to recover key) or contains 32 bytes in BE for X point (in case of
|
||||
// success). This function uses Neo.Cryptography.Secp256r1Recover syscall.
|
||||
func Secp256r1Recover(r []byte, s []byte, messageHash []byte, isEven bool) []byte {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue