예제 #1
0
def test_urlsafe_base64decode():
    l = base64_to_long(N)
    # convert it to base64
    bys = long2intarr(l)
    data = struct.pack("%sB" % len(bys), *bys)
    if not len(data):
        data = "\x00"
    s0 = base64.b64encode(data)
    # try to convert it back to long, should throw an exception if the strict
    # function is used
    with pytest.raises(ValueError):
        base64url_to_long(s0)

    # Not else, should not raise exception
    l = base64_to_long(s0)
    assert l
예제 #2
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)