Skip to content

Instantly share code, notes, and snippets.

View tpmccallum's full-sized avatar

Timothy McCallum tpmccallum

View GitHub Profile
dir(umbral)
[   'BigNum',
    'BytesIO',
    'Capsule',
    'CapsuleFrag',
    'ChallengeResponse',
    'GenericUmbralError',
    'KFrag',
 'List',
dir(keys)
[   'BigNum',
    'Point',
    'Scrypt',
    'SecretBox',
    'UmbralParameters',
    'UmbralPrivateKey',
    'UmbralPublicKey',
 'Union',
dir(config)
[   '_CONFIG',
    '__builtins__',
    '__cached__',
    '__doc__',
    '__file__',
    '__loader__',
    '__name__',
 '__package__',
>>> config.set_default_curve()
bob_priv_key = keys.UmbralPrivateKey.gen_key()
bob_pub_key = bob_priv_key.get_pubkey()
plaintext = b'Proxy Re-encryption is cool!!'
alice_ciphertext, umbral_capsule = umbral.encrypt(alice_pub_key, plaintext)
print(alice_ciphertext)
alice_decrypted_data = umbral.decrypt(umbral_capsule, alice_priv_key, alice_ciphertext, alice_pub_key)
print(alice_decrypted_data)
bob_capsule = umbral_capsule
kfrags, _ = umbral.split_rekey(alice_priv_key, bob_pub_key, 10, 20)

rand_min_shares = random.sample(kfrags, 10)