Skip to content

Commit

Permalink
Require pyca/cryptography>=3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
uzlonewolf committed Nov 16, 2023
1 parent 5591ec7 commit 7d94c80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
cryptography # Encryption - AES can also be provided via PyCryptodome or pyaes or pyca/cryptography
cryptography>=3.1 # Encryption - AES can also be provided via PyCryptodome or pyaes or pyca/cryptography
requests # Used for Setup Wizard - Tuya IoT Platform calls
colorama # Makes ANSI escape character sequences work under MS Windows.
5 changes: 4 additions & 1 deletion tinytuya/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,13 @@
Crypto = AES = CRYPTOLIB = None
try:
if clib == 'pyca/cryptography': # https://cryptography.io/en/latest/
from cryptography import __version__ as Crypto_version
if (Crypto_version[:2] == '0.') or (Crypto_version[:2] == '1.') or (Crypto_version[:2] == '2.') or (Crypto_version == '3.0'):
# cryptography <= 3.0 requires a backend= parameter
continue
from cryptography.hazmat.primitives.ciphers import Cipher as Crypto
from cryptography.hazmat.primitives.ciphers import modes as Crypto_modes
from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography import __version__ as Crypto_version
elif clib == 'PyCryptodomex': # https://pycryptodome.readthedocs.io/en/latest/
# PyCryptodome is installed as "Cryptodome" when installed by
# `apt install python3-pycryptodome` or `pip install pycryptodomex`
Expand Down

0 comments on commit 7d94c80

Please sign in to comment.