Skip to content

Commit 4745a71

Browse files
authored
Merge pull request #86 from jschlyter/warn_rsa1_5
deprecate alg=RSA1_5
2 parents 286fcea + 005d8ba commit 4745a71

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/cryptojwt/jwe/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
],
3333
}
3434

35+
DEPRECATED = {
36+
"alg": ["RSA1_5"],
37+
"enc": [],
38+
}
39+
3540

3641
class Encrypter(object):
3742
"""Abstract base class for encryption algorithms."""

src/cryptojwt/jwx.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
"""A basic class on which to build the JWS and JWE classes."""
22
import json
33
import logging
4+
import warnings
45

56
import requests
67

78
from cryptojwt.jwk import JWK
89
from cryptojwt.key_bundle import KeyBundle
910

1011
from .exception import HeaderError
12+
from .jwe import DEPRECATED
1113
from .jwk.jwk import key_from_jwk_dict
1214
from .jwk.rsa import RSAKey
1315
from .jwk.rsa import import_rsa_key
@@ -91,6 +93,8 @@ def __init__(self, msg=None, with_digest=False, httpc=None, **kwargs):
9193
raise ValueError("x5u")
9294
else:
9395
self._dict[key] = _val
96+
if key in DEPRECATED and _val in DEPRECATED[key]:
97+
warnings.warn(f"{key}={_val} deprecated")
9498

9599
def _set_jwk(self, val):
96100
if isinstance(val, dict):

0 commit comments

Comments
 (0)