14 Commits

Author SHA1 Message Date
3f215cdb39 Validation consistency between format & validation modules
The best place to catch share problems is immediately during parsing from
`&str`, however, because `validate_shares` takes any type that implements the
`IsShare` trait, and there's nothing about that trait that guarantees that the
share id, threshold, and secret length will be valid, I thought it best to leave
those three tests in `validate_shares` as a defensive coding practice.
2018-08-13 21:29:39 +02:00
88743caad8 Simplify share threshold and secret length consistency validation
I think that using hashmaps and hash sets was overkill and made the code much
longer and complicated than it needed to be.

The new code also produces more useful error messages that will hopefully help
users identify which share(s) are causing the inconsistency.
2018-08-13 21:29:39 +02:00
a6046dde48 Validate shares have the same data length 2018-08-13 21:29:39 +02:00
55b7c78a3a Add ErrorKind::ShareParsingInvalidShareThreshold
Ensures that threshold > 2 during the parsing process, since we ensure the same
during the splitting process.
2018-08-13 21:29:39 +02:00
cdcf012a59 Remove DuplicateShareData error and validation
It's possible that two different points have the same data.

To give a concrete example consider the secret polynomial `x^2 + x + s`, where
`s` is the secret byte. Plugging in 214 and 215 (both elements of the cyclic
subgroup of order 2) for `x` will give the same result, `1 + s`.

More broadly, for any polynomial `b*x^t + b*x^(t-1) + ... + x + s`, where `t` is
the order of at least one subgroup of GF(256), for all subgroups of order `t`,
all elements of that subgroup, when chosen for `x`, will produce the same
result.

There are certainly other types of polynomials that have "share collisions."
This type was just easy to find because it exploits the nature of finite fields.
2018-08-13 21:29:39 +02:00
3e89d1b1ca Add a test for issue #43.
Regardless of threshold, all polynomials are lines due to small syntactic error
2018-03-03 17:01:55 +01:00
40f6190a9b Preliminary implementation of deterministic secret sharing
#32
2018-02-11 22:17:07 +01:00
cb44533c62 wrapped_secrets::generate_shares: make MIME type optional. 2017-08-04 18:14:56 +02:00
4b73faf3e4 Support for wrapped_secrets containing versioning and MIME info. 2017-01-05 20:57:10 +01:00
ef4d525703 Adding share_num field to errors. 2016-12-20 23:10:47 +01:00
f5ab309dd6 Refactoring to allow for a more flexible API. 2016-12-02 14:56:12 +01:00
aeb8e4c21f New share format. (#13)
* Removing Coverall support until fixed. (See #12)

* Changing Cargo license.

* New wrapping of share data to support signatures.
2016-11-18 12:34:06 +01:00
2806bc49bc Tests & CI. 2016-04-06 18:42:51 +02:00
0abd8fac82 Working on test vectors. 2016-04-06 18:42:51 +02:00