コード例 #1
0
def test_decapsulation_by_alice(alices_keys):
    alice_priv, alice_pub = alices_keys

    sym_key, capsule = pre._encapsulate(alice_pub.point_key)
    assert len(sym_key) == 32

    # The symmetric key sym_key is perhaps used for block cipher here in a real-world scenario.
    sym_key_2 = pre._decapsulate_original(alice_priv.bn_key, capsule)
    assert sym_key_2 == sym_key
コード例 #2
0
def test_decapsulation_by_alice(alices_keys):
    delegating_privkey, _signing_privkey = alices_keys

    sym_key, capsule = pre._encapsulate(
        delegating_privkey.get_pubkey().point_key)
    assert len(sym_key) == 32

    # The symmetric key sym_key is perhaps used for block cipher here in a real-world scenario.
    sym_key_2 = pre._decapsulate_original(delegating_privkey.bn_key, capsule)
    assert sym_key_2 == sym_key