Ejemplo n.º 1
0
    def test_algo_parameter_removes_alg_from_algorithms_list(self, jws):
        assert "none" in jws.get_algorithms()
        assert "HS256" in jws.get_algorithms()

        jws = PyJWS(algorithms=["HS256"])
        assert "none" not in jws.get_algorithms()
        assert "HS256" in jws.get_algorithms()
Ejemplo n.º 2
0
    def test_algo_parameter_removes_alg_from_algorithms_list(self, jws):
        assert 'none' in jws.get_algorithms()
        assert 'HS256' in jws.get_algorithms()

        jws = PyJWS(algorithms=['HS256'])
        assert 'none' not in jws.get_algorithms()
        assert 'HS256' in jws.get_algorithms()
Ejemplo n.º 3
0
    def test_ecdsa_related_algorithms(self, jws):
        jws = PyJWS()
        jws_algorithms = jws.get_algorithms()

        if has_crypto:
            assert "ES256" in jws_algorithms
            assert "ES384" in jws_algorithms
            assert "ES521" in jws_algorithms
        else:
            assert "ES256" not in jws_algorithms
            assert "ES384" not in jws_algorithms
            assert "ES521" not in jws_algorithms
Ejemplo n.º 4
0
    def test_ecdsa_related_algorithms(self, jws):
        jws = PyJWS()
        jws_algorithms = jws.get_algorithms()

        if has_crypto:
            assert 'ES256' in jws_algorithms
            assert 'ES384' in jws_algorithms
            assert 'ES512' in jws_algorithms
        else:
            assert 'ES256' not in jws_algorithms
            assert 'ES384' not in jws_algorithms
            assert 'ES512' not in jws_algorithms
Ejemplo n.º 5
0
    def test_rsa_related_algorithms(self, jws):
        jws = PyJWS()
        jws_algorithms = jws.get_algorithms()

        if has_crypto:
            assert "RS256" in jws_algorithms
            assert "RS384" in jws_algorithms
            assert "RS512" in jws_algorithms
            assert "PS256" in jws_algorithms
            assert "PS384" in jws_algorithms
            assert "PS512" in jws_algorithms

        else:
            assert "RS256" not in jws_algorithms
            assert "RS384" not in jws_algorithms
            assert "RS512" not in jws_algorithms
            assert "PS256" not in jws_algorithms
            assert "PS384" not in jws_algorithms
            assert "PS512" not in jws_algorithms