aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/envelope.go
diff options
context:
space:
mode:
Diffstat (limited to 'whisper/envelope.go')
-rw-r--r--whisper/envelope.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/whisper/envelope.go b/whisper/envelope.go
index 93e3ea1a3..9daaf6490 100644
--- a/whisper/envelope.go
+++ b/whisper/envelope.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/crypto/ecies"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -96,10 +97,14 @@ func (self *Envelope) Open(key *ecdsa.PrivateKey) (msg *Message, err error) {
if key == nil {
return message, nil
}
- switch message.decrypt(key) {
+ err = message.decrypt(key)
+ switch err {
case nil:
return message, nil
+ case ecies.ErrInvalidPublicKey: // Payload isn't encrypted
+ return message, err
+
default:
return nil, fmt.Errorf("unable to open envelope, decrypt failed: %v", err)
}