Commit Graph

329 Commits

Author SHA1 Message Date
Matias Alejo Garcia 71f992138b add check in constructor of Address 2014-07-24 01:40:56 -03:00
Matias Alejo Garcia 19584e1f26 add check in constructor 2014-07-24 01:40:13 -03:00
Matias Alejo Garcia 3dd09129c8 fix tests 2014-07-23 19:56:19 -03:00
Matias Alejo Garcia 85e013c620 fix tests 2014-07-23 19:55:18 -03:00
Matias Alejo Garcia cad0fcf993 update tests 2014-07-23 19:51:34 -03:00
Matias Alejo Garcia 15c55e560a support uncompressed pub keys also 2014-07-23 19:49:42 -03:00
Matias Alejo Garcia 14d3165a73 add fromPubKey to SIN 2014-07-23 18:53:57 -03:00
Christopher Jeffrey 017f044b53 paypro: fix browser signatures with KJUR. move pem/der functions to common. 2014-07-21 19:52:43 -07:00
Christopher Jeffrey 604ac04f47 paypro: split up paypro into node/browser/common. 2014-07-21 18:15:52 -07:00
Christopher Jeffrey 2741f7509f paypro: minor - remove useless text processing. 2014-07-21 14:56:48 -07:00
Christopher Jeffrey fa1c4b3570 paypro: add DERtoPEM and PEMtoDER tests. 2014-07-21 14:56:48 -07:00
Christopher Jeffrey 14966082ae paypro: separate tests for x509+sha256 and x509+sha1. 2014-07-21 14:56:47 -07:00
Christopher Jeffrey 02f9ce8dfd paypro: temporarily fix tests. 2014-07-21 14:56:47 -07:00
Christopher Jeffrey 45ff292ade paypto: alter tests to improve consistency with signature and verification tests. 2014-07-21 14:56:47 -07:00
Christopher Jeffrey 0db74604db paypro: update root certs and fix tests. 2014-07-21 14:55:10 -07:00
Christopher Jeffrey cc7657d843 paypro: treat pki_data as an array. 2014-07-21 14:55:10 -07:00
Christopher Jeffrey 2e422c001e paypro: fix payment protocol for DER certs. 2014-07-21 14:55:10 -07:00
Christopher Jeffrey 3dc7a4ab84 test: fix x509 tests for PayPro. 2014-07-21 14:54:03 -07:00
Christopher Jeffrey 13553a42d1 x509: try different certs/keys/pems. 2014-07-21 14:54:03 -07:00
Christopher Jeffrey c209e3172d paypro: x509 nonsense. 2014-07-21 14:54:03 -07:00
Christopher Jeffrey 1d0f01c133 paypro: first pass at implementing payment protocol for x509. 2014-07-21 14:54:03 -07:00
Ryan X. Charles 098c613cb0 SIN should call EncodedData constructor
Creating SINs was broken due to not calling the parent constructor, shich sets
"converts" and "_encoding". I've fixed the problem and added tests that reveal
the error.
2014-07-18 09:24:57 -07:00
Ryan X. Charles 0c8f7d4d21 move bitcore-dev.js -> bundle.js
To make it easier to test the master branch of bitcore with other apps,
especially Copay.
2014-07-17 16:30:47 -07:00
Ryan X. Charles 49ff6c7b76 add further tests for Key 2014-07-17 15:44:28 -07:00
Ryan X. Charles 57a55d0863 expose signature internal functions
"sign" and "genk" ... and add some signature tests
2014-07-17 15:24:19 -07:00
Ryan X. Charles 2c136d4dcc remove obsolete Curve class (G and n now accessible from Point) 2014-07-17 13:14:49 -07:00
Ryan X. Charles 5f6d02f5de add proper DER signature support to Key
both creating DER signature from the r and s values, and parsing a DER
signature into the r, s, and other properties.
2014-07-17 13:09:35 -07:00
Ryan X. Charles e485d0e331 Merge pull request #432 from ryanxcharles/feature/proto
Correct deprecated setting of __proto__
2014-07-16 16:24:22 -07:00
Ryan X. Charles c4e22bf5fd Merge pull request #431 from ryanxcharles/bug/SIGHASH_ANYONECANPAY
use correct constant & share between Transaction and ScriptInterpreter
2014-07-16 16:24:14 -07:00
Ryan X. Charles fc7b5b11c7 Merge pull request #429 from ryanxcharles/feature/update-bn.js
update bn.js to latest version
2014-07-16 16:23:53 -07:00
Ryan X. Charles 95d180c2a3 add ScriptInterpreter example to test 2014-07-16 11:39:12 -07:00
Ryan X. Charles 71f181efee add tests to EncodedData and fix hex conversion bug
...making sure the new changes to __proto__ are working correctly.
2014-07-15 18:21:38 -07:00
Ryan X. Charles 895bb6bab9 use correct constant & share between Transaction and ScriptInterpreter
Closes https://github.com/bitpay/bitcore/issues/424
2014-07-15 11:59:56 -07:00
Ryan X. Charles 0251d467c4 update bn.js to latest version
...and correspondingly get rid of Number->String conversion

See: https://github.com/indutny/bn.js/issues/17
2014-07-15 11:25:18 -07:00
Ryan X. Charles 92ac073035 run secp256k1 test vectors in Key where they also matter 2014-07-11 15:05:38 -07:00
Ryan X. Charles 572035fdd5 add some test vectors for secp256k1 2014-07-11 14:47:48 -07:00
Ryan X. Charles 0f0a1b1913 add some sanity checks to signature verification 2014-07-11 12:04:34 -07:00
Ryan X. Charles 8a199e26f3 allow Point to multiply things other than buffers
...i.e., bignums, numbers, and strings. Also, ensure that if you try to
multiply a buffer, it should be exactly 32 bytes. Eventually this "multiply"
function will be replaced with a more conventional "mul" function, but not yet.
2014-07-11 11:52:05 -07:00
Ryan X. Charles 3f75bea924 add tests for toCompressedPubKey 2014-07-10 19:03:40 -07:00
Ryan X. Charles 992e1cfcfb uncomment part of TransactionBuilder test 2014-07-10 18:56:43 -07:00
Ryan X. Charles 9c23256a16 add tests to make sure bignum interface works correctly 2014-07-10 18:45:09 -07:00
Ryan X. Charles 32cf5aa941 woops - add bignum back to browser tests 2014-07-10 18:27:02 -07:00
Ryan X. Charles fb3cc38046 make bignum tests run in node, not just browser 2014-07-10 18:17:11 -07:00
Ryan X. Charles af1d754bd8 make bignum interface backwards compatible
- fix cmp, mul, div, add, mod, sub functions to take numbers and strings
- fix Point class to use common folder correctly
2014-07-10 18:14:13 -07:00
Ryan X. Charles 9ca869b95b add "ECKey" to Key test so grepping is easier 2014-07-10 16:22:42 -07:00
Ryan X. Charles ac4d3186bf update sign function to use elliptic 2014-07-10 16:22:42 -07:00
Ryan X. Charles 15d4328b35 use elliptic in Point in the browser instead of cryptojs 2014-07-10 16:21:08 -07:00
Ryan X. Charles c8fe404402 replace bignumber.js with bn.js 2014-07-10 16:20:13 -07:00
Manuel Araoz 0e2df698cd fix SIN and add tests 2014-07-10 17:17:24 -03:00
Ryan X. Charles 65ab3a663a fix string/buffer sjcl issue
...by using sjcl.mode.cbc.encrypt/decrypt rather than sjcl.encrypt/decrypt. The
difference is that the sjcl.encrypt/decrypt functions are really convenience
methods designed to encrypt and decrypt strings, but don't play nice with
binary data, as revealed in the tests in this commit and the previous commit.
Basically, if you use them to encrypt and decrypt binary data as a string, it
will return the wrong result or an error.

The solution is to use the block cipher directly, in this case sjcl.mode.cbc.
This also has the advantage of fewer format conversions - no converting to
base64 and JSON strings. This makes things faster. Also, it is actually correct
unlike the previous method.
2014-07-09 16:25:48 -07:00