示例#1
0
def test_cmp_rsa_ec():
    _key1 = RSAKey()
    _key1.load_key(import_rsa_key_from_cert_file(CERT))

    _key2 = ECKey(**ECKEY)

    assert _key1 != _key2
示例#2
0
def test_cmp_rsa():
    _key1 = RSAKey()
    _key1.load_key(import_rsa_key_from_cert_file(CERT))

    _key2 = RSAKey()
    _key2.load_key(import_rsa_key_from_cert_file(CERT))

    assert _key1 == _key2
示例#3
0
def test_kspec():
    _ckey = import_rsa_key_from_cert_file(CERT)
    _key = RSAKey()
    _key.load_key(_ckey)

    jwk = _key.serialize()
    assert jwk["kty"] == "RSA"
    assert jwk["e"] == JWK["keys"][0]["e"]
    assert jwk["n"] == JWK["keys"][0]["n"]

    assert not _key.is_private_key()
示例#4
0
def test_extract_rsa_from_cert_2():
    _ckey = import_rsa_key_from_cert_file(CERT)
    _key = RSAKey()
    _key.load_key(_ckey)

    assert _ckey.public_numbers().n == base64_to_long(_key.n)
示例#5
0
def test_verify_2():
    _key = RSAKey()
    _key.load_key(import_rsa_key_from_cert_file(CERT))
    assert _key.verify()