Skip to content

deprecate alg=RSA1_5 #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/cryptojwt/jwe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
],
}

DEPRECATED = {
"alg": ["RSA1_5"],
"enc": [],
}


class Encrypter(object):
"""Abstract base class for encryption algorithms."""
Expand Down
4 changes: 4 additions & 0 deletions src/cryptojwt/jwx.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
"""A basic class on which to build the JWS and JWE classes."""
import json
import logging
import warnings

import requests

from cryptojwt.jwk import JWK
from cryptojwt.key_bundle import KeyBundle

from .exception import HeaderError
from .jwe import DEPRECATED
from .jwk.jwk import key_from_jwk_dict
from .jwk.rsa import RSAKey
from .jwk.rsa import import_rsa_key
Expand Down Expand Up @@ -91,6 +93,8 @@ def __init__(self, msg=None, with_digest=False, httpc=None, **kwargs):
raise ValueError("x5u")
else:
self._dict[key] = _val
if key in DEPRECATED and _val in DEPRECATED[key]:
warnings.warn(f"{key}={_val} deprecated")

def _set_jwk(self, val):
if isinstance(val, dict):
Expand Down