fix: avoid to fail on imports if cryptography is missing

This commit is contained in:
Éloi Rivard 2023-12-29 17:17:19 +01:00
parent 395b6ab4f3
commit d49e669cab
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184
2 changed files with 9 additions and 5 deletions

View file

@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
Fixed
*****
- Avoid to fail on imports if ``cryptography`` is missing.
[0.0.41] - 2023-12-25
=====================

View file

@ -1,9 +1,8 @@
from cryptography.hazmat.backends import default_backend as crypto_default_backend
from cryptography.hazmat.primitives import serialization as crypto_serialization
from cryptography.hazmat.primitives.asymmetric import rsa
def generate_keypair():
from cryptography.hazmat.backends import default_backend as crypto_default_backend
from cryptography.hazmat.primitives import serialization as crypto_serialization
from cryptography.hazmat.primitives.asymmetric import rsa
key = rsa.generate_private_key(
backend=crypto_default_backend(), public_exponent=65537, key_size=2048
)