aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/envelope.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-17 02:55:57 +0800
committerobscuren <geffobscura@gmail.com>2014-12-17 02:55:57 +0800
commit52b54631a47dfa46742635be178f2f8d33dd9f41 (patch)
tree5d99624cd5df30c9747039dd874559a974af9bdd /whisper/envelope.go
parent93edae280d60d217084430a0c6c16f648c82732e (diff)
downloaddexon-52b54631a47dfa46742635be178f2f8d33dd9f41.tar.gz
dexon-52b54631a47dfa46742635be178f2f8d33dd9f41.tar.zst
dexon-52b54631a47dfa46742635be178f2f8d33dd9f41.zip
Whisper watches fixes
Diffstat (limited to 'whisper/envelope.go')
-rw-r--r--whisper/envelope.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/whisper/envelope.go b/whisper/envelope.go
index dc8d3cda4..066e20f6a 100644
--- a/whisper/envelope.go
+++ b/whisper/envelope.go
@@ -74,11 +74,13 @@ func (self *Envelope) Open(prv *ecdsa.PrivateKey) (msg *Message, err error) {
message.Flags = data[0]
message.Signature = data[1:66]
}
- message.Payload = data[dataStart:]
+
+ payload := data[dataStart:]
if prv != nil {
- message.Payload, err = crypto.Decrypt(prv, message.Payload)
+ message.Payload, err = crypto.Decrypt(prv, payload)
switch err {
case ecies.ErrInvalidPublicKey: // Payload isn't encrypted
+ message.Payload = payload
return &message, err
default:
return nil, fmt.Errorf("unable to open envelope. Decrypt failed: %v", err)