Skip to content

Commit

Permalink
Merge pull request #94 from WFT/fix-crypto-deprecation
Browse files Browse the repository at this point in the history
Fix deprecation cryptography deprecation warning in tests
  • Loading branch information
alexanderjordanbaker authored Jun 9, 2024
2 parents 1c8573e + c23ced3 commit 4234c96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
def create_signed_data_from_json(path: str) -> str:
data = read_data_from_file(path)
decoded_data = json.loads(data)
private_key = ec.generate_private_key(ec.SECP256R1).private_bytes(encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()).decode()
private_key = ec.generate_private_key(ec.SECP256R1()).private_bytes(encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()).decode()
return jwt.encode(payload=decoded_data, key=private_key, algorithm='ES256')

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

def read_data_from_file(path: str) -> str:
Expand Down

0 comments on commit 4234c96

Please sign in to comment.