Commit Graph

332 Commits (master)

Author SHA1 Message Date
jMyles 5f80feb6ba Tests now need to separate Alice's delegating key from her signing key. 2018-05-24 17:28:30 -07:00
tuxxy 4c610e32f9 Use Capsule.get_size in capsule serializer tests 2018-05-23 05:06:39 -06:00
David Núñez 0dbb86e6f1 Enter KFrag._point_xcoord: an ephemeral pk used during reconstruction instead of Alice's pk 2018-05-09 00:19:23 +02:00
David Núñez c6ba6e5ae9 Fixed old example of metadata 2018-05-09 00:19:09 +02:00
David Núñez 0dd3d4b991 Change KFrag.bn_id to a random byte sequence (Solves #123) 2018-05-09 00:18:45 +02:00
jMyles 31a55eed93 Moving kfrag verification logic to _pre. 2018-05-06 14:32:42 -07:00
jMyles af9d8b251d Updating caller logic to use new `CapsuleFrag._verify_correctness` 2018-05-05 19:03:21 -07:00
jMyles c5fbcc3a1c Moving exception inside if block; testing it. 2018-05-05 11:15:40 +02:00
David Nuñez 84dcb4eaaf Removed unused import 2018-04-30 03:47:43 +02:00
David Nuñez e57cb01c23 Removed Point.get_order_from_curve 2018-04-30 03:33:56 +02:00
tuxxy 923ad2944f Rename BigNum -> CurveBN
Change all references from BigNum to CurveBN
2018-04-24 12:41:40 -06:00
David Nuñez 63f63b4235 Big renaming 2018-04-24 10:42:10 -07:00
David Nuñez c7d6644447 A simpler example for re-encryption metadata 2018-04-24 10:35:21 +02:00
David Nuñez 97f77cfcdc Fixed import 2018-04-24 10:23:40 +02:00
David Nuñez 316bb6b5de Test for decryption fail when there is no proof but it was expected 2018-04-24 10:23:30 +02:00
David Nuñez 036b28571a Tests for multiple possibilities of serialization of cfrags with/without proofs and with/without metadata 2018-04-23 00:09:58 +02:00
David Nuñez b714f47d10 Some renaming 2018-04-19 13:14:33 +02:00
David Nuñez bdab54bb8d Refine correctness tests 2018-04-19 13:04:03 +02:00
David Nuñez 159b2dd720 Merge remote-tracking branch 'nucypher/master' into cfrags-with-correctness-proof 2018-04-19 00:23:48 +02:00
David Nuñez 3f03ce769d Fixed failing test 2018-04-19 00:23:35 +02:00
David Nuñez ab748c67b5 Check that an UmbralCorrectnessError is raised, and that it includes the incorrect cfrags 2018-04-18 23:39:46 +02:00
David Nuñez b39b1cadf9 I said no more Challenges! 2018-04-18 23:02:10 +02:00
David Nuñez c13da88c62 No more Challenge for you 2018-04-18 23:00:21 +02:00
David Nuñez d87af0b129 Remove metadata as parameter of verification in tests 2018-04-18 12:00:26 +02:00
David Nuñez 2885a1f4dc Adapted tests to metadata inside CorrectnessProofs
TODO: Figure out final size for CorrectnessProofs
2018-04-18 11:41:47 +02:00
David Nuñez fc6f7a1ac3 Adapting tests to new setting with CorrectnessProof 2018-04-18 00:11:05 +02:00
David Nuñez 071d4b163a TODO: Figure out final size for CFrags with proofs 2018-04-18 00:10:33 +02:00
David Nuñez a03837dc72 More renaming 2018-04-17 13:02:04 +02:00
David Nuñez 3610004773 pre._check_challenge() --> pre._verify_correctness_proof() 2018-04-17 12:43:08 +02:00
David Nuñez e275cb66c6 pre._challenge() --> pre._prove_correctness 2018-04-17 12:29:44 +02:00
David Nuñez 45b4529ca1 Adapted tests to CorrectnessProof 2018-04-17 12:17:27 +02:00
David Nuñez ae95441b35 derive_private_key_from_label --> derive_privkey_by_label 2018-04-16 23:08:04 +02:00
David Nuñez 4818c00bfb Merge remote-tracking branch 'nucypher/master' into derive-keys-from-labels
# Conflicts:
#	tests/test_keys/test_umbral_keys.py
#	umbral/keys.py
2018-04-16 23:00:29 +02:00
David Nuñez 7c00469be4 Tests for serialization of UmbralKeyingMaterial 2018-04-16 12:52:05 +02:00
David Nuñez 3f93331a3a Adapt tests to UmbralKeyingMaterial 2018-04-16 12:44:20 +02:00
jMyles 0bd004d454 Test for using UmbralPublicKey as a dict key. 2018-04-14 08:59:04 -07:00
jMyles 3257b3853c Test for UmbralPublicKey equality. Fixes #106. 2018-04-14 08:57:52 -07:00
tuxxy 7206415055 Add test for encoder/decoder params in to/from_bytes functions 2018-04-10 17:09:38 -06:00
David Nuñez 8bdd40b099 Add tests for derived keys generation 2018-04-09 12:13:15 +02:00
David Nuñez 2e4d15dedd Merge remote-tracking branch 'nucypher/master' into tests-improvements 2018-04-04 12:26:12 +02:00
jMyles caea15cb7a Fixing parameter order and cleaning up some imports. 2018-04-02 19:00:41 -07:00
tuxxy 34807581e6 Inject params on encrypt, decrypt, and open_capsule 2018-04-02 18:16:43 -07:00
David Nuñez 5a17f4c857 More representative challenge metadata example in tests 2018-03-31 09:57:43 -07:00
David Nuñez 010daae066 Made pre.challenge and pre.check_challenge private 2018-03-18 01:53:32 +01:00
David Nuñez 5be059770e Made _decapsulate_reencrypted private 2018-03-18 01:49:52 +01:00
David Nuñez 0639854a85 Changed order of arguments in pre.decrypt() 2018-03-18 01:48:05 +01:00
David Nuñez 17467431ca Dropped pre.gen_priv() and pre.priv2pub()
Resolves #90
2018-03-15 11:07:56 +01:00
David Nuñez f1211478a8 c_frag, k_frag --> cfrag, kfrag 2018-03-15 10:49:18 +01:00
David Nuñez 965d278cfb Remove unnecessary test
This made sense before, when we still had the consistency checks for
kFrags
2018-03-15 10:43:46 +01:00
David Nuñez 21df6a9160 More specific error handling in test 2018-03-15 10:40:02 +01:00
David Nuñez c8e2f6a588 Remove unnecessary assertions in tests 2018-03-15 10:32:57 +01:00
David Nuñez d9f20943cd Fixed undesired behavior of some tests 2018-03-14 12:24:15 +01:00
David Nuñez 5bd0503ca8 Improvements to the tests 2018-03-14 12:00:04 +01:00
David Nuñez 5edd97e5c7 Merge remote-tracking branch 'nucypher/master' 2018-03-14 09:49:01 +01:00
Kieran Prasch 89b7477311 Deweaponize test data language, and suggest more a peaceful usage of pyUmbral. 2018-03-13 09:53:50 -07:00
David Nuñez dda693450e KFrag ids can only be computed by Bob now 2018-03-13 13:08:30 +01:00
tuxxy 2b7742f9d2 Add tests 2018-03-07 18:30:40 -07:00
David Nuñez 1678a6cc27 Some changes to variable names 2018-02-27 09:08:27 +01:00
David Nuñez c1a30c3056 Removed KFrag consistency checks (#77) 2018-02-26 15:36:56 +01:00
jMyles 1dabacba37 Fixing some imports. 2018-02-23 01:00:16 -08:00
jMyles 4420e27f21 Capsule creation with the wrong type now raises TypeError - updating a test to reflect that. 2018-02-23 00:59:55 -08:00
jMyles 86074d71da Test showing that a Point can't be made if it's not on its curve. 2018-02-22 23:31:18 -08:00
jMyles fab9270c71 Test showing that a Point can't be made if it's not on its curve. 2018-02-22 23:30:40 -08:00
Kieran Prasch 2fe575ce6d Reorganizes tests into a descriptive namespace. 2018-02-22 22:24:09 -08:00
jMyles 2cedc7689e @KPrasch is right - no need for those square brackets. And a test too. 2018-02-22 18:53:34 -08:00
jMyles e0a069bb9a umbral.umbral -=> umbral.pre 2018-02-22 18:21:30 -08:00
Kieran R Prasch 47e6275cf5 Ensures simple api is testable on multiple curves, with a test session default set. 2018-02-13 13:44:21 -08:00
Kieran R Prasch 2678470a30 Sets the default curve for tests once. (except for multicurve tests.) 2018-02-13 13:30:52 -08:00
jMyles 501f0c4ba6 Changing all implemented instances of get_pub_key() to get_pubkey() 2018-02-13 12:50:44 -08:00
jMyles d6527e47fd get_pubkey, not get_pub_key. Also, raising NotImplemented on UmbralPublicKey. 2018-02-13 12:46:28 -08:00
Kieran R Prasch 76f2a985dd Upgrades GenericUmbralError to an exception class; raise capsule.NotValid if capsule verification fails. 2018-02-12 14:48:34 -08:00
Kieran R Prasch 3ed2394acf Thins TestKeyPair named tuple; excludes name attr for clarity/reusability.. 2018-02-12 13:04:24 -08:00
Kieran R Prasch ec511552f2 resotres k_frag consistency checks in some tests. 2018-02-12 10:49:36 -08:00
Kieran R Prasch 204043f55f changes multi-curve xfail reason. 2018-02-12 10:22:02 -08:00
Kieran R Prasch 9590bc4a60 restores commented out umbral tests to latest umbral api. 2018-02-11 03:02:52 -08:00
Kieran R Prasch 2cef73c58c Adds comment for expected test failure. 2018-02-11 02:11:06 -08:00
Kieran R Prasch 608d97e081 Merge remote-tracking branch 'upstream/master' into umbral_tests 2018-02-11 01:59:01 -08:00
Kieran R Prasch 1b5e46f9e5 Restores test_cheating_ursula_sends_garbage with the latest interface. 2018-02-11 01:55:20 -08:00
Justin Holmes b85bf19e44
Merge pull request #62 from KPrasch/umbral_tests
Reintroduces test sending Ursula a fake k_frag
2018-02-10 22:53:27 -05:00
tuxxy 0d4ad0d3e6 save_key -> to_bytes, load_key -> from_bytes 2018-02-10 20:21:16 -07:00
Kieran R Prasch 7abeb8133e Reintroduces test for sending fake k_frag to ursula 2018-02-10 19:12:22 -08:00
Kieran R Prasch 6e03bafb13 Parametrizes point serializer tests. 2018-02-10 16:27:45 -08:00
Kieran R Prasch fecc2d9ffa Additional coverage for ec Point serializer edge cases and exceptions. 2018-02-10 15:28:46 -08:00
Kieran R Prasch 0f59cf5729 Additional point and bignum assertions for type checking. Marks xfail for multicurve simple api. 2018-02-10 14:19:47 -08:00
Kieran R Prasch c97a4b165f removes old test module. 2018-02-10 04:49:51 -08:00
Kieran R Prasch 84751c3332 Mocked openssl backend test pass through and constant time operations. 2018-02-10 04:49:51 -08:00
Kieran R Prasch 003e0f16b1 Test coverage for comparing disperate types (bn, int); Patches actual openssl equality into mock backend. 2018-02-10 04:49:51 -08:00
Kieran R Prasch 780bd4af31 tests simple api on multiple curves. 2018-02-10 04:49:51 -08:00
Kieran R Prasch 66f7b39287 Additional mock openssl commentary. 2018-02-10 04:49:51 -08:00
Kieran R Prasch cf4a7dd729 Patched openssl bn_mod_inverse invokes actual function. 2018-02-10 04:49:51 -08:00
Kieran R Prasch 3591bf756e Moving point tests into module. 2018-02-10 04:49:51 -08:00
Kieran R Prasch 004247ce5d Adds test coverage for bignum arithmetic with mock openssl backend 2018-02-10 04:49:51 -08:00
Kieran R Prasch 7387e51a9e Splits point test into submodules, replaces test globals with module fixtures. 2018-02-10 04:49:51 -08:00
Kieran R Prasch 26875da4a2 Refactors mocked openssl fixture for reusability; additional tests for ec point arithmetic. 2018-02-10 04:49:51 -08:00
Kieran R Prasch 97cceedc30 Creates opeenssl mocked backend pytest fixture. 2018-02-10 04:49:51 -08:00
jMyles 5501a75392 Tests for default curve when no default curve is set. 2018-02-08 21:41:10 -08:00
Kieran R Prasch 1cb9aba0a9 Adds a pair of tests for Point.__mul__. 2018-02-08 18:57:59 -08:00
tuxxy efacd03e3e Add to_cryptography_pub_key method to Point and add tests
Fix naming of to_cryptography_pub_key
2018-02-08 17:06:47 -07:00
tuxxy e7d2a53277 Add to_cryptography_priv_key method and test for BigNum 2018-02-08 16:47:24 -07:00
tuxxy 4154fe1253 Add test for pubkey encryption (encryption for bob) 2018-02-08 15:46:42 -07:00
jMyles 13790d5388 Test that shows errors being raised if dumb things are attempted with config. 2018-02-08 11:29:56 -08:00
tuxxy 74b131d2ad Remove PRE class and make it a module and fix tests 2018-02-08 02:30:56 -07:00
jMyles 9adda4500d Various from_bytes now tested with default params. 2018-02-07 20:39:28 -08:00
jMyles d25aeb86c8 Tests no longer pass curve into gen_rand(). 2018-02-07 20:38:39 -08:00
jMyles 59170d4082 PRE (which is soon to be a module anyway) uses default params for testing. 2018-02-07 20:09:47 -08:00
jMyles 272185d478 Inject curve in test_gen_key. 2018-02-07 20:07:55 -08:00
jMyles 668dcf0a60 Set default curve for test suite. 2018-02-07 20:07:09 -08:00
tuxxy e0a5853ae4 Fix typo _recontruct -> _reconstruct 2018-02-07 03:13:57 -07:00
tuxxy 86cdb5ccca Add __bytes__ to UmbralPublicKey 2018-02-07 03:13:25 -07:00
jMyles cba6f007f2 The method to make an activated Capsule is now Capsule._reconstruct_shamirs_secret(). 2018-02-02 16:56:13 -08:00
jMyles aabec3f4ce We don't actually "reconstruct" a Capsule. We activate it. 2018-02-01 16:16:12 -08:00
jMyles b9c24203cf Removing "PRE" dependency injection into PRE instance. 2018-02-01 09:06:11 -08:00
tuxxy a98d18d084 Set UmbralParameters as an attribute on Umbral keys w/ test updates 2018-02-01 03:21:07 -07:00
tuxxy 73666b2154 Have tests not pass in params by default except for one 2018-02-01 01:47:59 -07:00
David Nuñez 84036b99f6 Extended previous test with another exception subtype 2018-01-31 16:46:35 +01:00
David Nuñez 1c300992eb Test for catching more specific exception wrt to invalid EC points 2018-01-31 16:46:35 +01:00
Tux 8764004e92
Merge branch 'master' into master 2018-01-31 01:40:21 -07:00
jMyles cd64f1d89b No more "is_reconstructed" needed. 2018-01-30 23:19:49 -08:00
jMyles 218f33a690 Reintroducing... PRE.decrypt! 2018-01-30 23:19:22 -08:00
jMyles 7b29302f10 Better names for some things. 2018-01-30 23:18:43 -08:00
jMyles 54acbf3fcf New, longer representation of a reconstructed (activated?) Capsule. 2018-01-30 22:39:54 -08:00
David Nuñez 18e596abda Cleaned old prints 2018-01-30 12:51:06 +01:00
David Nuñez 201a40132f Test to check compliance of SECP256k1 generator wrt to SEC standard 2018-01-30 12:23:58 +01:00
jMyles 40d3bdca06 A test for the unequal cases. 2018-01-29 07:51:26 -08:00
jMyles 0df84c4104 Test for compatibility from reconstructed bytes. 2018-01-29 07:51:26 -08:00
jMyles 3fb70db054 Better test for equality for original capsule. 2018-01-29 07:51:26 -08:00
jMyles 007ef5d626 Test now uses decrypt() instead of get_contents(). 2018-01-28 21:07:14 -08:00
jMyles b4744d8731 pre.decrypt_reencryted moved to capsule.get_contents 2018-01-28 18:02:44 -08:00
jMyles 5e66579d4d Made decapsulate_reencrypted public. 2018-01-28 17:50:49 -08:00
jMyles 3311bb6b8e Removed random from test imports. Also some linting. 2018-01-28 10:28:31 -08:00
jMyles 211a920cbe Test for invalid capsule raising an exception. 2018-01-27 18:27:37 -08:00
jMyles d943ba297a Moving _reconstructed_bytes into to_bytes. 2018-01-26 21:53:24 -08:00
jMyles 0eef0c289c Touching up TODOs. 2018-01-26 21:48:00 -08:00
jMyles c0782a2696 Single from_bytes method. See https://github.com/nucypher/pyUmbral/pull/24#discussion_r162469880 2018-01-26 21:37:01 -08:00
jMyles f792fdf54e PRE is no longer injected. 2018-01-26 21:27:29 -08:00
jMyles 6a18e5f420 Method to get components for comparison. 2018-01-26 21:27:29 -08:00
jMyles a11ea36e61 We can get a Capsule from either original or reconstructed bytes. 2018-01-26 21:27:28 -08:00
jMyles 6c0f260446 Comparing newly reconstructed Capsule (which is just a Capsule) to original. 2018-01-26 21:27:28 -08:00
jMyles 418f7be540 Test for single capsule, not ReconstructedCapsule. 2018-01-26 21:27:28 -08:00
tuxxy 050b0b3bdd Use constants in tests and add comment 2018-01-25 17:06:17 -07:00
tuxxy 405a93cd35 Add tests for DEM and some fixes 2018-01-24 14:52:49 -07:00
tuxxy f7687d0f81 Name unused variables
Add more unused variables
2018-01-23 20:00:15 -07:00
tuxxy b1f04f7d54 Calculate recipient public key from recipient's private key in decrypt_reencrypted 2018-01-23 13:50:14 -07:00
tuxxy 4974686d30 Use priv/pub_key_alice in test 2018-01-23 13:46:12 -07:00
tuxxy 3eafb28897 Add tests and fix a few things 2018-01-23 04:28:51 -07:00
tuxxy 00c5089b8b Add tests for checking generated keys 2018-01-23 00:34:33 -07:00
tuxxy 9bb9168323 Add tests for UmbralPrivateKey and UmbralPublicKey 2018-01-19 06:08:39 -07:00
jMyles a3a9180dfd More description of bytestrings lengths. 2018-01-17 14:17:00 -05:00
jMyles 2145debe21 Using "kfrags" as a name for KFrags throughout test. 2018-01-17 14:17:00 -05:00
jMyles 9689817b01 Here's what my linter has to say about the tests. :-) 2018-01-17 14:16:59 -05:00
jMyles f79ca09393 A more informative way to show the proper number of bytes for a CFrag. 2018-01-17 14:15:23 -05:00
David Nuñez 599bad38b3 Include pub_a and pub_b as input to the kFrag signature to avoid
potential reuse of kFrags from other RKs (i.e., not from A to B)
2018-01-17 17:54:37 +01:00
David Nuñez 97340ec0c5 Updated variable names to include type 2018-01-17 11:37:34 +01:00
tuxxy 763a7271c7 Fix naming from KFrag.point_key to KFrag.bn_key 2018-01-16 11:08:13 -07:00
tuxxy d2f22c1438 Add test for ChallengeResponse serialization/deserialization 2018-01-15 17:11:44 -07:00
tuxxy e48ef28104 Add test for ReconstructedCapsule serialization/deserialization 2018-01-15 16:34:22 -07:00
tuxxy f133664d91 Add test for Capsule serialization/deserialization 2018-01-15 15:50:39 -07:00
tuxxy 444800a919 Add test for CapsuleFrag serialization/deserialization 2018-01-15 15:40:24 -07:00
tuxxy 9036cdc9aa Add test for KFrag serialization/deserialization 2018-01-15 15:20:18 -07:00
David Nuñez 381fe19b82 UmbralParameters are fixed before initialization of PRE 2018-01-10 16:14:00 +01:00
David Nuñez 620bec85f8 Changed check_original to Capsule method (verify).
Renamed KFrag.check_signature to verify.
2018-01-10 15:57:53 +01:00
David Nuñez 146e139409 Changed check_kFrag_signature to a KFrag method (check_signature) 2018-01-10 15:52:43 +01:00
David Nuñez ba3395728d Moved hash_to_bn to utils, and changed check_kfrag_consistency as a
KFrag method
2018-01-10 15:42:34 +01:00
David Nuñez 6d70c80541 Added cFrag list and capsule reconstruction to Capsule. Had to comment
most tests for a while because of the syntax changes
2018-01-09 11:02:53 +01:00
David Nuñez a324dec7c0 changed test_encapsulation to test_decapsulation_by_alice 2018-01-03 21:00:04 +01:00
jMyles dcd9b37d29 Changing argument order (keys first, capsule(s) second). Added type hint for ReconstructedCapsule. 2018-01-03 13:36:17 -05:00
jMyles 9b8bd2c235 Merge commit for naming changes contemporaneously made by @cygnusv. 2018-01-03 13:01:35 -05:00
jMyles cfce67f4cd Let's still use PEP8 names for frag variables (ie, kfrags, not kFrags) 2018-01-03 12:46:52 -05:00
jMyles 5c8259f026 A reconstructed capsule - a "recapsule" for short? 2018-01-03 12:26:16 -05:00
jMyles 0bf2ad8946 Calling it a "capsule" in encapsulation test. 2018-01-03 12:25:50 -05:00
David Nuñez 4b9f395f84 some renaming of internal variables, still a lot pending. 2018-01-03 01:33:39 +01:00
David Nuñez 6bbfa48d78 Adjust tests variables to current naming scheme (#7) 2018-01-03 00:54:41 +01:00
David Nuñez bae7388e7e Added test case for when Ursula sends random garbage as the result of
re-encryption
2018-01-02 11:01:24 +01:00
David Nuñez 828fcdb295 Added test case for kFrag consistency 2018-01-02 10:53:05 +01:00
David Nuñez 11bb2bc23b Added test case where Ursula tries to cheat by reusing a previous
reencryption
2018-01-02 10:43:50 +01:00
David Nuñez 3969ee3948 some name changes as per #7 2017-12-30 01:18:23 +01:00
David Nuñez 73a6169806 Test invalid points in the curve 2017-12-29 01:39:28 +01:00
David Nuñez 3673e35021 Added re-encrypt, combine, decapsulate_reencrypted, challenge, and
check_challenge
2017-12-29 01:13:16 +01:00
David Nuñez 49d501883e Testing from/to bytes in Point 2017-12-29 01:12:14 +01:00
David Nuñez 368dbe4c52 Fixed hash_to_bn 2017-12-28 15:02:53 +01:00
David Nuñez ddd0c51d76 Added superbasic test for bignum that fails. Undefined problem with
from_int and to_int
2017-12-28 12:58:34 +01:00
David Nuñez bcc593f1ab Basic stuff (encapsulate & decapsulate, hash_to_bn, etc) 2017-12-28 02:07:37 +01:00