Commit Graph

19 Commits

Author SHA1 Message Date
Gustav Simonsson
f98e002d98 Address pull request comments; key header and hex encoding
* Remove key header from unencrypted key file format and replace
  it with a version field
* Change encoding of bytes in key files from base64 to hex
2015-05-12 17:22:17 +02:00
Gustav Simonsson
313eec33ad Revert "Add key header to unencrypted key file"
This reverts commit a94d4ba0b53c4558ab838aaed635a2ff66ddfa53.
2015-05-12 17:19:39 +02:00
Gustav Simonsson
cd88295f5a Add key header to unencrypted key file 2015-05-12 17:19:39 +02:00
Gustav Simonsson
29a5a92d13 Add key header to encrypted keys
* Add key header containing key version, kdf and kdf params
* Store key header as JSON in the key file
* Read in KDF params from key header
* Include key header in MAC calculation and MAC verification
2015-05-12 17:19:39 +02:00
Gustav Simonsson
da9fe951da Use common.Address type for accounts.Address 2015-05-12 17:19:39 +02:00
Gustav Simonsson
6b23094cff Improve key store passphrase crypto
* Change MAC-then-Encrypt to Encrypt-then-MAC
* Change AES256 to AES128
* Use first 16 bytes of KDF derived key for AES and
  remaining 16 for MAC
2015-05-12 17:18:30 +02:00
Gustav Simonsson
9918b6c84e Remove the awesome, ever misunderstood entropy mixing 2015-05-12 17:18:30 +02:00
Bas van Kervel
b79dd188d9 replaced several path.* with filepath.* which is platform independent 2015-05-12 14:24:11 +02:00
Felix Lange
119bea22aa crypto: switch to golang.org/x/crypto
code.google.com/p/go.crypto is deprecated and will cause
problems in future versions of Go.
2015-02-17 13:05:58 +01:00
Gustav Simonsson
8c056aebe1 Set both key generation and ECDSA nonce to use mixed entropy
* Move random entropy functions to new package randentropy
* Add function to get n bytes entropy where up to first 32
  bytes are mixed with OS entropy sources
2015-02-10 22:49:28 +01:00
Gustav Simonsson
8d9752a557 Address pull request comments
* Use crypto.Sign instead of directly calling secp256k1 lib
* Rename UserAccount to Account and Addr to Address (for consistency)
* Change AccountManager.Sign to take ptr to Account instead of
  address byte array
* Simplify copying of Accounts in Accounts()
* PubkeyToAddress and GetEntropyCSPRNG now exported
2015-01-28 05:12:57 +01:00
Gustav Simonsson
512ffa2bf4 Add accounts package and refactor key stores
* Add initial UserAccount and AccountManager structs
* Add NewAccount, Sign and Accounts functions
* Refactor key stores to use key address as main identifier
  while keeping the UUID.
* Use key address as file/dir names instead of UUID
2015-01-26 04:30:17 +01:00
Gustav Simonsson
8af42d42da CamelCase aesCBCDecrypt 2015-01-21 19:08:05 +01:00
Gustav Simonsson
1f8290ca44 Add ImportPreSaleKey
* ImportPreSaleKey takes a KeyStore, a presale key JSON (e.g. file content)
  and a password string. It stores the key in the given key store.
* Refactored common AES decryption and moved some functions to crypto.go
2015-01-21 16:35:43 +01:00
Gustav Simonsson
d48140cab3 Address pull request comments
* Further simplify "constructor" function's allocation of structs
* Fix formatting
2015-01-19 22:12:22 +01:00
Gustav Simonsson
3cf038f300 Address pull request comments
* Allocate with composite literal instead of new
* Remove check of number of bytes read from rand
2015-01-19 20:24:30 +01:00
Gustav Simonsson
9caf32befe Update code comments 2015-01-15 19:58:38 +01:00
Gustav Simonsson
47d3b3dd58 Address pull request comments
* Remove flags field from key struct
* Change JSON struct fields from string to []byte
* Change GenerateNewKey API to take io.Reader for random source
* Remove mixing entropy source function
* Use testing Fatal in tests
2015-01-15 19:40:10 +01:00
Gustav Simonsson
a1c2749380 Address pull request comments
* Simplify scrypt constants with const block
* Add key store constructors and make their types private
* Simplify key store and file namings to be less Java Enterprise™
* Change test error logging to use t.Error(err)
* Reduce number of naked returns (just like my ex-gf)
* Simplify file reading path code
2015-01-15 19:40:10 +01:00