Commit graph

291 commits

Author SHA1 Message Date
Josh Rickmar
9ffb1ecd80 Add Common Name to certificate.
Some applications fail to parse the certificate if the CN is not set,
even if they (correctly) check SANs before the CN when validating a
hostname.  Even though the CN should be ignored if a matching SAN
hostname was found, we can prevent the parse from failing by also
including the hostname as the CN.

Additionally, switch from maps to slices to prevent DNS names and IP
addresses from being reordered when added to the certificate template.
2015-06-15 16:14:08 -04:00
Josh Rickmar
53b0b8cd09 Fix typo in test. 2015-06-11 16:39:44 -04:00
Dave Collins
1b73e9828d Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
Dave Collins
9556412b01 Update for recent wire API hash error changes. 2015-04-17 01:13:40 -05:00
Dave Collins
e330838900 Remove error return from Block.Sha function.
This commit remove the error return from the Block.Sha function since it
can never fail and ends up causing a lot of unneeded error checking
throughout the code base.
2015-04-17 00:42:08 -05:00
Dave Collins
ff58d6571d Update golang.org/x/crypto import paths to new location. 2015-03-03 21:09:03 -06:00
Dave Collins
499e9e0daa Update btcec path import paths to new location. 2015-02-06 10:35:18 -06:00
Dave Collins
1324fa1fad Update btcnet path import paths to new location. 2015-02-05 23:30:03 -06:00
Josh Rickmar
56fe089f4e Update Go versions for Travis. 2015-02-05 17:56:03 -05:00
Dave Collins
80b97479bd Update btcwire path import paths to new location. 2015-02-05 14:48:38 -06:00
Dave Collins
d71631b41f Update btcchain import paths to new location. 2015-01-30 16:15:57 -06:00
Dave Collins
b29aad9f09 Update btcscript import paths to new location. 2015-01-30 12:11:32 -06:00
Josh Rickmar
dca623d4ef Optimize base58 decoding.
This change introduces an autogenerated base58 digit table to remove
the need to find the index of a character in the modified base58
alphabet each time.  Additionally, it removes some unnecessary big
integer allocations to cut down on the GC churn.

Before:
BenchmarkBase58Encode         20          64998995 ns/op           0.08 MB/s
BenchmarkBase58Decode         50          35965928 ns/op           0.19 MB/s

Now:
BenchmarkBase58Encode         20          64644351 ns/op           0.08 MB/s
BenchmarkBase58Decode        200           7914748 ns/op           0.86 MB/s
2015-01-24 14:59:51 -05:00
Dave Collins
9dcef5b30f Update btcscript import paths to new location. 2015-01-16 19:35:54 -06:00
Dave Collins
b2c2b14526 Update btcchain import paths to new location. 2015-01-16 18:45:21 -06:00
Dave Collins
9e2037d6db Update btcec import paths to new location. 2015-01-16 18:04:23 -06:00
Dave Collins
7ac9b42a52 Update btcnet import paths to new location. 2015-01-16 17:36:18 -06:00
Dave Collins
fdc00f8eff Update btcwire import paths to new location. 2015-01-16 15:26:50 -06:00
Dave Collins
5dada8b184 Update fastsha256 import paths to new location. 2015-01-16 09:20:22 -06:00
Dave Collins
f80c4d718d Update btcutil import paths in README.md files. 2015-01-15 21:35:29 -06:00
Dave Collins
506d333934 Update btcutil import paths to new location. 2015-01-15 15:13:38 -06:00
Josh Rickmar
40ba1daf69 Add Amount.ToBTC convenience method.
Closes #26.
2015-01-02 09:19:16 -05:00
Dave Collins
8180321217 Add quick overview about addresses to doc.go.
Closes #4.
2014-12-22 13:39:51 -06:00
Dave Collins
97fea16721 Add package documentation for base58 package.
This commit adds a doc.go file in the base58 package which provides
package documentation for godoc.
2014-12-22 12:36:34 -06:00
Dave Collins
ff8cbd1786 Add testable examples for base58 package.
This commit creates and an example test file for the baes58 package that
integrates nicely with Go's example tooling.

This allows the example output to be tested as a part of running the
normal Go tests to help ensure it doesn't get out of date with the code.
2014-12-22 11:58:06 -06:00
Dave Collins
cef307c87e Complete base58 migration to new package. 2014-12-22 10:56:00 -06:00
Dave Collins
fffd6a2e87 Add benchmarks to base58 package. 2014-12-22 10:45:21 -06:00
Dave Collins
a630ef8247 A few minor modifications to new base58 package.
- Call out in README.md that this is modified base58 (it's not the same as
  normal base58)
- Remove the blurb about test_coverage.txt since it is no longer needed
  now that the repo now has coveralls integrated
- Rename base58_check[_test].go -> basecheck[_test].go.  Since Go treats
  _<ext> special in some cases like for tests and conditional OS and
  architecture compilation, it's a good idea to avoid naming files with
  them to ensure a new special meaning doesn't break builds in the future
2014-12-22 10:29:07 -06:00
benma
07db1b5a70 Integrate the new base58 package. 2014-12-22 12:01:50 +01:00
benma
a72a54be16 Create a new sub-package base58.
It consists of the previous base58 implementation and new
base58 check encoding/decoding functions.
2014-12-22 11:43:07 +01:00
Dave Collins
a3d5cbad22 Add basic tests for NewTLSCertPair. 2014-12-20 15:30:08 -06:00
Dave Collins
5509c323a4 Add test coverage badge to README.md. 2014-12-20 05:19:47 -06:00
Dave Collins
cd83976947 Update TravisCI to use goclean script. 2014-12-20 05:01:59 -06:00
David Hill
c64741f903 Add PEM encode error checking 2014-12-13 10:29:36 -05:00
Josh Rickmar
f9cc0f47b4 Switch to new subrepo import paths. 2014-12-11 10:28:43 -05:00
Jonathan Gillham
a5298a643e Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:54:42 +01:00
Dave Collins
ea27722dac Export the hdkeychain min and max seed byte lens. 2014-09-25 22:13:42 -05:00
Dave Collins
2539ca9860 Fix hdkeychain to avoid zeroing net version bytes.
This commit corrects the Zero function in hdkeychain to nil the version
instead of zeroing the bytes.  This is necessary because the keys are
holding onto a reference into the specific version bytes for the network
as provided by the btcnet package.  Zeroing them causes the bytes in the
btcnet package to be zeroed which then leads to issues later when trying
to use them.

Also, to prevent regressions, new tests have been added to exercise this
scenario.

Pointed out by @jimmysong.
2014-09-08 14:30:56 -05:00
Josh Rickmar
d4a2dd199b Update test coverage report. 2014-09-01 21:16:08 -05:00
Josh Rickmar
3fd010412c Remove embedded bloom.Filter mutex.
This prevents the caller from being able to accidentally lock or
unlock access to the filter internal state.

While here, remove several defers that do not gain us any readability,
and only hurt our performance.
2014-09-01 21:16:08 -05:00
Jonathan Gillham
47c887338f Made App Engine runtime compatible. 2014-08-30 15:10:29 -05:00
David Hill
24a92fd581 Add bloom filter Reload method. 2014-08-29 22:45:35 -04:00
David Hill
00f245b959 Fix formatting directives in tests.
Found by 'go vet'
2014-08-28 10:32:49 -04:00
Dave Collins
f6d6cd5d27 Update hdkeychain test coverage report. 2014-08-18 18:18:16 -05:00
Dave Collins
7bd19adb47 Test variable declaration consistency. 2014-08-18 18:17:58 -05:00
Dave Collins
f8ad0939a2 Add new function on extended keys to zero them.
This commit adds a new function named Zero on the hdkeychain.ExtendedKey
which can be used to manually clear the memory used for an extended key.
This is useful for enhanced security by allowing the caller to explicitly
clear the memory when they're done with a key.  Otherwise it might hang
around in memory for a while.

Once a key has been zeroed it is no longer usable.

This commit also contains tests to ensure everything works as expected
after a key has been zeroed.
2014-08-18 17:54:20 -05:00
Dave Collins
a36fbe9ade Correct DefaultWalletLayout example link. 2014-07-22 17:18:15 -05:00
Dave Collins
8f049a120c Correct example links in hdkeychain READEME.md. 2014-07-22 17:17:14 -05:00
Dave Collins
e6c5ca2a6a Implement hdkeychain BIP0032 API.
This commit adds a new sub-package named hdkeychain which can be used to
derive hierarchical deterministic key chains which form the foundation of
hd wallets.

- Support for private and public extended keys
- Convenient cryptographically secure seed generation
- Simple creation of master nodes
- Support for multi-layer derivation
- Easy serialization and deserialization for both private and public
  extended keys
- Support for custom networks by registering them with btcnet
- Obtaining the underlying EC pubkeys, EC privkeys, and associated bitcoin addresses
  ties in seamlessly with existing btcec and btcutil types which provide
  powerful tools for working with them to do things like sign transactions
  and generate payment scripts
- Makes use of the btcec package which is highly optimized for secp256k1
- Code examples including:
  - Generating a cryptographically secure random seed and deriving a
    master node from it
  - Default HD wallet layout as described by BIP0032
  - Audits use case as described by BIP0032
- Comprehensive test coverage including the BIP0032 test vectors
- Benchmarks
2014-07-22 17:11:46 -05:00
David Hill
4a3482182f update comment. 2014-07-10 11:10:44 -04:00