Esempio n. 1
0
def test_pick_use():
    keys = KeyBundle(JWKS_WITH_USE)
    _jws = JWS(
        "foobar",
        alg="RS256",
        kid="R3NJRW1EVHRsaUcwSXVydi14cVVoTmxhaU4zckU1MlFPa05NWGNpUUZtcw")
    _keys = _jws.pick_keys(keys, use="sig")
    assert len(_keys) == 1
Esempio n. 2
0
def test_pick_wrong_alg():
    keys = KeyBundle(JWKS_b)
    _jws = JWS("foobar", alg="EC256", kid="rsa1")
    with pytest.raises(ValueError):
        _keys = _jws.pick_keys(keys, use="sig")
Esempio n. 3
0
def test_pick_use():
    keys = KeyBundle(JWK_b)
    _jws = JWS("foobar", alg="RS256", kid="MnC_VZcATfM5pOYiJHMba9goEKY")
    _keys = _jws.pick_keys(keys, use="sig")
    assert len(_keys) == 1