Skip to content

Commit

Permalink
[bugfix] panic when creating wallet
Browse files Browse the repository at this point in the history
1. fixbug : 'panic: crypto/cipher: input not full blocks'

Cause of the byte length of private key generated by crypto.GenKeyPair
is not equal to 32.

Signed-off-by: NoelBright <[email protected]>
  • Loading branch information
NoelBright authored and gdmmx committed Nov 16, 2018
1 parent 7e72efb commit de25fb5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ func GenKeyPair() ([]byte, PubKey, error) {
return nil, *mPubKey, err
}

privkey := make([]byte, util.PRIVATEKEYLEN)
copy(privkey[util.PRIVATEKEYLEN-len(privateD):], privateD)

mPubKey.X = new(big.Int).Set(X)
mPubKey.Y = new(big.Int).Set(Y)
return privateD, *mPubKey, nil

return privkey, *mPubKey, nil
}

func Sign(privateKey []byte, data []byte) ([]byte, error) {
Expand Down

0 comments on commit de25fb5

Please sign in to comment.