示例#1
0
def test_kspec():
    _ckey = x509_rsa_loads(open(CERT).read())
    _jwk = RSA_key(key=_ckey)
    _jwk.decomp()

    print _jwk
    assert _jwk.kty == "RSA"
    assert _jwk.e == JWK["keys"][0]["e"]
    assert _jwk.n == JWK["keys"][0]["n"]
示例#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