aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-13 16:36:13 +0800
committerGitHub <noreply@github.com>2018-10-13 16:36:13 +0800
commitbb800319674e8a0f22769ae4af668c66e9536b15 (patch)
treed287f0dd389419ea962a3ffbf261fb0fe1a83044 /core
parent09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94 (diff)
downloaddexon-consensus-bb800319674e8a0f22769ae4af668c66e9536b15.tar
dexon-consensus-bb800319674e8a0f22769ae4af668c66e9536b15.tar.gz
dexon-consensus-bb800319674e8a0f22769ae4af668c66e9536b15.tar.bz2
dexon-consensus-bb800319674e8a0f22769ae4af668c66e9536b15.tar.lz
dexon-consensus-bb800319674e8a0f22769ae4af668c66e9536b15.tar.xz
dexon-consensus-bb800319674e8a0f22769ae4af668c66e9536b15.tar.zst
dexon-consensus-bb800319674e8a0f22769ae4af668c66e9536b15.zip
core: crypto: ecdsa: add method to create PrivateKey from ecdsa.PrivateKey (#195)
Diffstat (limited to 'core')
-rw-r--r--core/crypto/ecdsa/ecdsa.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/crypto/ecdsa/ecdsa.go b/core/crypto/ecdsa/ecdsa.go
index 0196c47..9556981 100644
--- a/core/crypto/ecdsa/ecdsa.go
+++ b/core/crypto/ecdsa/ecdsa.go
@@ -57,6 +57,15 @@ func NewPrivateKey() (*PrivateKey, error) {
}, nil
}
+// NewPrivateKeyFromECDSA creates a new PrivateKey structure from
+// ecdsa.PrivateKey.
+func NewPrivateKeyFromECDSA(key *ecdsa.PrivateKey) *PrivateKey {
+ return &PrivateKey{
+ privateKey: *key,
+ publicKey: *newPublicKey(key),
+ }
+}
+
// newPublicKey creates a new PublicKey structure.
func newPublicKey(prvKey *ecdsa.PrivateKey) *publicKey {
return &publicKey{