()
| 62 | |
| 63 | |
| 64 | def test_not_supported_alg(): |
| 65 | public_key = read_file_path("rsa_public.pem") |
| 66 | private_key = read_file_path("rsa_private.pem") |
| 67 | |
| 68 | jwe = JsonWebEncryption() |
| 69 | s = jwe.serialize_compact( |
| 70 | {"alg": "RSA-OAEP", "enc": "A256GCM"}, "hello", public_key |
| 71 | ) |
| 72 | |
| 73 | jwe = JsonWebEncryption(algorithms=["RSA1_5", "A256GCM"]) |
| 74 | with pytest.raises(errors.UnsupportedAlgorithmError): |
| 75 | jwe.serialize_compact( |
| 76 | {"alg": "RSA-OAEP", "enc": "A256GCM"}, |
| 77 | "hello", |
| 78 | public_key, |
| 79 | ) |
| 80 | with pytest.raises(errors.UnsupportedCompressionAlgorithmError): |
| 81 | jwe.serialize_compact( |
| 82 | {"alg": "RSA1_5", "enc": "A256GCM", "zip": "DEF"}, |
| 83 | "hello", |
| 84 | public_key, |
| 85 | ) |
| 86 | with pytest.raises(errors.UnsupportedAlgorithmError): |
| 87 | jwe.deserialize_compact( |
| 88 | s, |
| 89 | private_key, |
| 90 | ) |
| 91 | |
| 92 | jwe = JsonWebEncryption(algorithms=["RSA-OAEP", "A192GCM"]) |
| 93 | with pytest.raises(errors.UnsupportedEncryptionAlgorithmError): |
| 94 | jwe.serialize_compact( |
| 95 | {"alg": "RSA-OAEP", "enc": "A256GCM"}, |
| 96 | "hello", |
| 97 | public_key, |
| 98 | ) |
| 99 | with pytest.raises(errors.UnsupportedCompressionAlgorithmError): |
| 100 | jwe.serialize_compact( |
| 101 | {"alg": "RSA-OAEP", "enc": "A192GCM", "zip": "DEF"}, |
| 102 | "hello", |
| 103 | public_key, |
| 104 | ) |
| 105 | with pytest.raises(errors.UnsupportedEncryptionAlgorithmError): |
| 106 | jwe.deserialize_compact( |
| 107 | s, |
| 108 | private_key, |
| 109 | ) |
| 110 | |
| 111 | |
| 112 | def test_inappropriate_sender_key_for_serialize_compact(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…