Skip to content

Commit dbbd735

Browse files
Merge pull request #61 from alexanderjordanbaker/BumpCryptoMaxVersions
Bump cryptography and pyOpenSSL maximum version
2 parents 12655d8 + acd24dd commit dbbd735

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
attrs >= 21.3.0
22
PyJWT >= 2.6.0, < 3
33
requests >= 2.28.0, < 3
4-
cryptography >= 40.0.0, < 42
5-
pyOpenSSL >= 23.1.1, < 24
4+
cryptography >= 40.0.0, < 43
5+
pyOpenSSL >= 23.1.1, < 25
66
asn1==2.7.0
77
cattrs==23.1.2

tests/util.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
def create_signed_data_from_json(path: str) -> str:
1616
data = read_data_from_file(path)
1717
decoded_data = json.loads(data)
18-
private_key = ec.generate_private_key(ES256).private_bytes(encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()).decode()
18+
private_key = ec.generate_private_key(ec.SECP256R1).private_bytes(encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()).decode()
1919
return jwt.encode(payload=decoded_data, key=private_key, algorithm='ES256')
2020

2121
def decode_json_from_signed_date(data: str) -> Dict[str, Any]:
22-
public_key = ec.generate_private_key(ES256).public_key().public_bytes(encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo).decode()
22+
public_key = ec.generate_private_key(ec.SECP256R1).public_key().public_bytes(encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo).decode()
2323
return decode_complete(jwt=data, key=public_key, algorithms=['ES256'], options={"verify_signature": False})
2424

2525
def read_data_from_file(path: str) -> str:
@@ -32,10 +32,6 @@ def read_data_from_binary_file(path: str) -> str:
3232
with open(full_path, mode='rb') as test_file:
3333
return test_file.read()
3434

35-
class ES256(ec.EllipticCurve):
36-
name="prime256v1"
37-
key_size = 256
38-
3935
def get_signed_data_verifier(env: Environment, bundle_id: str, app_apple_id: int = 1234) -> SignedDataVerifier:
4036
verifier = SignedDataVerifier([read_data_from_binary_file('tests/resources/certs/testCA.der')], False, env, bundle_id, app_apple_id)
4137
verifier._chain_verifier.enable_strict_checks = False # We don't have authority identifiers on test certs

0 commit comments

Comments
 (0)