aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-02-18 16:24:12 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2017-02-18 16:24:12 +0800
commit9b0af513867fad4aeb3516e4711dd0ea4f5bc90c (patch)
treeb37d808d57873c6aec550431534e26602dfd0475 /whisper/whisperv5
parentbf21549faa7de6e2b920855468b14856c6f503c4 (diff)
downloaddexon-9b0af513867fad4aeb3516e4711dd0ea4f5bc90c.tar
dexon-9b0af513867fad4aeb3516e4711dd0ea4f5bc90c.tar.gz
dexon-9b0af513867fad4aeb3516e4711dd0ea4f5bc90c.tar.bz2
dexon-9b0af513867fad4aeb3516e4711dd0ea4f5bc90c.tar.lz
dexon-9b0af513867fad4aeb3516e4711dd0ea4f5bc90c.tar.xz
dexon-9b0af513867fad4aeb3516e4711dd0ea4f5bc90c.tar.zst
dexon-9b0af513867fad4aeb3516e4711dd0ea4f5bc90c.zip
crypto: add btcec fallback for sign/recover without cgo (#3680)
* vendor: add github.com/btcsuite/btcd/btcec * crypto: add btcec fallback for sign/recover without cgo This commit adds a non-cgo fallback implementation of secp256k1 operations. * crypto, core/vm: remove wrappers for sha256, ripemd160
Diffstat (limited to 'whisper/whisperv5')
-rw-r--r--whisper/whisperv5/message.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/whisper/whisperv5/message.go b/whisper/whisperv5/message.go
index a095f7c0c..255ad380d 100644
--- a/whisper/whisperv5/message.go
+++ b/whisper/whisperv5/message.go
@@ -30,6 +30,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/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"golang.org/x/crypto/pbkdf2"
@@ -163,7 +164,7 @@ func (msg *SentMessage) encryptAsymmetric(key *ecdsa.PublicKey) error {
if !ValidatePublicKey(key) {
return fmt.Errorf("Invalid public key provided for asymmetric encryption")
}
- encrypted, err := crypto.Encrypt(key, msg.Raw)
+ encrypted, err := ecies.Encrypt(crand.Reader, ecies.ImportECDSAPublic(key), msg.Raw, nil, nil)
if err == nil {
msg.Raw = encrypted
}
@@ -293,7 +294,7 @@ func (msg *ReceivedMessage) decryptSymmetric(key []byte, salt []byte, nonce []by
// decryptAsymmetric decrypts an encrypted payload with a private key.
func (msg *ReceivedMessage) decryptAsymmetric(key *ecdsa.PrivateKey) error {
- decrypted, err := crypto.Decrypt(key, msg.Raw)
+ decrypted, err := ecies.ImportECDSA(key).Decrypt(crand.Reader, msg.Raw, nil, nil)
if err == nil {
msg.Raw = decrypted
}