def test_to_jwe(keytype, alg, enc):
    msg = Message(a="foo", b="bar", c="tjoho")
    _jwe = msg.to_jwe(KEYJAR.get_encrypt_key(keytype, ""), alg=alg, enc=enc)
    with pytest.raises(HeaderError):
        Message().from_jwt(_jwe, KEYJAR, encalg="RSA-OAEP", encenc=enc)
    with pytest.raises(HeaderError):
        Message().from_jwt(_jwe, KEYJAR, encenc="A256CBC-HS512", encalg=alg)
Exemple #2
0
def test_to_jwe(keytype, alg, enc):
    msg = Message(a='foo', b='bar', c='tjoho')
    _jwe = msg.to_jwe(KEYJAR.get_encrypt_key(keytype, ''), alg=alg, enc=enc)
    with pytest.raises(HeaderError):
        Message().from_jwt(_jwe, KEYJAR, encalg="RSA-OAEP", encenc=enc)
    with pytest.raises(HeaderError):
        Message().from_jwt(_jwe, KEYJAR, encenc="A256CBC-HS512", encalg=alg)
def test_to_jwe(keytype, alg, enc):
    msg = Message(a="foo", b="bar", c="tjoho")
    _jwe = msg.to_jwe(KEYJAR.get_encrypt_key(keytype, ""), alg=alg, enc=enc)
    msg1 = Message().from_jwe(_jwe, KEYJAR.get_encrypt_key(keytype, ""))
    assert msg1 == msg
Exemple #4
0
def test_to_jwe(keytype, alg, enc):
    msg = Message(a='foo', b='bar', c='tjoho')
    _jwe = msg.to_jwe(KEYJAR.get_encrypt_key(keytype, ''), alg=alg, enc=enc)
    msg1 = Message().from_jwe(_jwe, KEYJAR.get_encrypt_key(keytype, ''))
    assert msg1 == msg