mirror of
https://github.com/status-im/whisper.git
synced 2025-01-21 08:09:20 +00:00
Forward and log EC recover err and remove dup pubkey len check
This commit is contained in:
parent
7c01fab58d
commit
a2d9bee9a9
@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
"github.com/ethereum/go-ethereum/logger/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Message struct {
|
type Message struct {
|
||||||
@ -32,7 +33,12 @@ func (self *Message) sign(key *ecdsa.PrivateKey) (err error) {
|
|||||||
|
|
||||||
func (self *Message) Recover() *ecdsa.PublicKey {
|
func (self *Message) Recover() *ecdsa.PublicKey {
|
||||||
defer func() { recover() }() // in case of invalid sig
|
defer func() { recover() }() // in case of invalid sig
|
||||||
return crypto.SigToPub(self.hash(), self.Signature)
|
pub, err := crypto.SigToPub(self.hash(), self.Signature)
|
||||||
|
if err != nil {
|
||||||
|
glog.V(0).Infof("Could not get pubkey from signature: ", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return pub
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Message) Encrypt(to *ecdsa.PublicKey) (err error) {
|
func (self *Message) Encrypt(to *ecdsa.PublicKey) (err error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user