示例#1
0
def test_loads_0():
    keys = load_jwks(json.dumps(JWK))
    assert len(keys) == 1
    key = keys[0]
    assert key.kid == "abc"
    assert key.kty == "RSA"

    _ckey = x509_rsa_loads(open(CERT).read())

    print key
    _n = long_to_mpi(base64_to_long(str(key.n)))
    assert _n == _ckey.n
    _e = long_to_mpi(base64_to_long(str(key.e)))
    assert _e == _ckey.e
示例#2
0
def test_x509_rsa_loads_2():
    _ckey = x509_rsa_loads(open(CERT).read())
    _jwk = RSA_key(key=_ckey)
    _jwk.decomp()

    print _jwk

    _n = long_to_mpi(base64_to_long(str(_jwk.n)))

    cn = jwe.hd2ia(hexlify(_ckey.n))
    jn = jwe.hd2ia(hexlify(_n))

    assert cn == jn