Пример #1
0
def test_get_key():
    ec_key = new_ec_key("P-256")
    asym_private_key = ECKey(priv_key=ec_key.priv_key)
    asym_public_key = ECKey(pub_key=asym_private_key.pub_key)
    key = SYMKey(key="mekmitasdigoatfo", kid="xyzzy")

    assert asym_private_key.private_key()
    assert asym_private_key.public_key()

    assert asym_public_key.private_key() is None
    assert asym_private_key.public_key()

    assert key.key
def test_get_key():
    ec_key = generate_private_key(NIST2SEC['P-256'], default_backend())
    asym_private_key = ECKey(priv_key=ec_key)
    asym_public_key = ECKey(pub_key=asym_private_key.pub_key)
    key = SYMKey(key='mekmitasdigoatfo', kid='xyzzy')

    assert asym_private_key.private_key()
    assert asym_private_key.public_key()

    assert asym_public_key.private_key() is None
    assert asym_private_key.public_key()

    assert key.key