diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-11 08:11:20 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-11 08:11:20 +0800 |
commit | 074ee19fe51a025a00bc3814748b268ae74c046c (patch) | |
tree | 070624364b070e9c75f8a6d9d8ffb18aeeaa751c | |
parent | 64933321fb58ab92cf505a4519fe93ae69e1c71d (diff) | |
parent | 58909117bea6a8185df3335300426b8a49542235 (diff) | |
download | dexon-074ee19fe51a025a00bc3814748b268ae74c046c.tar.gz dexon-074ee19fe51a025a00bc3814748b268ae74c046c.tar.zst dexon-074ee19fe51a025a00bc3814748b268ae74c046c.zip |
Merge branch 'develop' into rpcfrontier
-rw-r--r-- | crypto/key.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/key.go b/crypto/key.go index ec4908c30..9dbf37467 100644 --- a/crypto/key.go +++ b/crypto/key.go @@ -26,7 +26,6 @@ package crypto import ( "bytes" "crypto/ecdsa" - "crypto/elliptic" "encoding/json" "io" @@ -87,18 +86,16 @@ func (k *Key) UnmarshalJSON(j []byte) (err error) { } func NewKey(rand io.Reader) *Key { - randBytes := make([]byte, 32) + randBytes := make([]byte, 64) _, err := rand.Read(randBytes) if err != nil { panic("key generation: could not read from random source: " + err.Error()) } reader := bytes.NewReader(randBytes) - _, x, y, err := elliptic.GenerateKey(S256(), reader) + privateKeyECDSA, err := ecdsa.GenerateKey(S256(), reader) if err != nil { - panic("key generation: elliptic.GenerateKey failed: " + err.Error()) + panic("key generation: ecdsa.GenerateKey failed: " + err.Error()) } - privateKeyMarshalled := elliptic.Marshal(S256(), x, y) - privateKeyECDSA := ToECDSA(privateKeyMarshalled) id := uuid.NewRandom() key := &Key{ |