diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-13 16:36:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-13 16:36:13 +0800 |
commit | bb800319674e8a0f22769ae4af668c66e9536b15 (patch) | |
tree | d287f0dd389419ea962a3ffbf261fb0fe1a83044 /core/crypto | |
parent | 09f943d9d4ebd151a8c6fdbd15ca3282edbc7e94 (diff) | |
download | dexon-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/crypto')
-rw-r--r-- | core/crypto/ecdsa/ecdsa.go | 9 |
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{ |