Merge pull request #648 from Gustav-Simonsson/forward_ecrecover_err_and_remove_dup_checks

Forward and log EC recover err and remove dup pubkey len check
This commit is contained in:
Jeffrey Wilcke 2015-04-07 20:48:56 +02:00
commit b80fdeac5b

View File

@ -5,6 +5,8 @@ import (
"time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
)
type Message struct {
@ -32,7 +34,12 @@ func (self *Message) sign(key *ecdsa.PrivateKey) (err error) {
func (self *Message) Recover() *ecdsa.PublicKey {
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(logger.Error).Infof("Could not get pubkey from signature: ", err)
return nil
}
return pub
}
func (self *Message) Encrypt(to *ecdsa.PublicKey) (err error) {