Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
54605d8c
Commit
54605d8c
authored
Dec 15, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
During env open check for pub error which indicated unencrypted payload.
parent
52ca80bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
envelope.go
whisper/envelope.go
+5
-1
whisper.go
whisper/whisper.go
+2
-1
No files found.
whisper/envelope.go
View file @
54605d8c
...
...
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/rlp"
"github.com/obscuren/ecies"
)
const
(
...
...
@@ -76,7 +77,10 @@ func (self *Envelope) Open(prv *ecdsa.PrivateKey) (msg *Message, err error) {
message
.
Payload
=
data
[
dataStart
:
]
if
prv
!=
nil
{
message
.
Payload
,
err
=
crypto
.
Decrypt
(
prv
,
message
.
Payload
)
if
err
!=
nil
{
switch
err
{
case
ecies
.
ErrInvalidPublicKey
:
// Payload isn't encrypted
return
&
message
,
err
default
:
return
nil
,
fmt
.
Errorf
(
"unable to open envelope. Decrypt failed: %v"
,
err
)
}
}
...
...
whisper/whisper.go
View file @
54605d8c
...
...
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
"github.com/obscuren/ecies"
"gopkg.in/fatih/set.v0"
)
...
...
@@ -229,7 +230,7 @@ func (self *Whisper) envelopes() (envelopes []*Envelope) {
func
(
self
*
Whisper
)
postEvent
(
envelope
*
Envelope
)
{
for
_
,
key
:=
range
self
.
keys
{
if
message
,
err
:=
envelope
.
Open
(
key
);
err
==
nil
{
if
message
,
err
:=
envelope
.
Open
(
key
);
err
==
nil
||
(
err
!=
nil
&&
err
==
ecies
.
ErrInvalidPublicKey
)
{
// Create a custom filter?
self
.
filters
.
Notify
(
filter
.
Generic
{
Str1
:
string
(
crypto
.
FromECDSA
(
key
)),
Str2
:
string
(
crypto
.
FromECDSAPub
(
message
.
Recover
())),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment