예제 #1
0
    def test_step_two_before_secret(self):
        alice = JPAKE(signer_id=b"alice")
        bob = JPAKE(signer_id=b"bob")

        bob.process_one(alice.one())

        self.assertRaises(OutOfSequenceError, bob.two)
예제 #2
0
    def test_skip_verification_one(self):
        secret = "hunter42"
        alice = JPAKE(secret=secret, signer_id=b"alice")
        bob = JPAKE(secret=secret, signer_id=b"bob")

        bob_one = bob.one()

        alice.process_one(gx3=bob_one['gx1'], gx4=bob_one['gx2'], verify=False)
예제 #3
0
    def test_process_one_twice(self):
        secret = "hunter42"
        alice = JPAKE(secret=secret, signer_id=b"alice")
        bob = JPAKE(secret=secret, signer_id=b"bob")

        alice_one = alice.one()

        bob.process_one(alice_one)
        self.assertRaises(OutOfSequenceError, bob.process_one, alice_one)
예제 #4
0
    def test_process_two_before_one(self):
        secret = "hunter42"
        alice = JPAKE(secret=secret, signer_id=b"alice")
        bob = JPAKE(secret=secret, signer_id=b"bob")

        bob.process_one(alice.one())

        bob_two = bob.two()

        self.assertRaises(OutOfSequenceError, alice.process_two, bob_two)
예제 #5
0
    def test_basic(self):
        secret = "hunter42"
        alice = JPAKE(secret=secret, signer_id=b"alice")
        bob = JPAKE(secret=secret, signer_id=b"bob")

        alice.process_one(bob.one()), bob.process_one(alice.one())

        alice.process_two(bob.two()), bob.process_two(alice.two())

        self.assertEqual(alice.K, bob.K)
예제 #6
0
from jpake import JPAKE
secret = "1234"
alice = JPAKE(secret=secret, signer_id=b"alice")
bob = JPAKE(secret=secret, signer_id=b"bob")

alice.process_one(bob.one())
bob.process_one(alice.one())

alice.process_two(bob.two())
bob.process_two(alice.two())

print(alice.K)
print(bob.K)