Расшифровка файла с помощью модуля Fernet в Python ⇐ Python
Расшифровка файла с помощью модуля Fernet в Python
def decrypt(self): if not os.path.exists(self.filename): raise Exception('File does not exist!') # Read the salt and HMAC digest from the separate file with open(self.filename + '.salt', 'rb') as file: k_sz = Fernet.key_size salt = file.read(k_sz) hmac_digest = file.read(hashlib.sha256().digest_size) here in the decrypt function i am trying to get the salt and hmac value stored in the encrypted file. But receiving the error
File "C:\python programs\test2.py", line 61, in decrypt k_sz = Fernet.key_size ^^^^^^^^^^^^^^^ AttributeError: type object 'Fernet' has no attribute 'key_size' i have tried .KEY_SIZE and Fernet(key=None).key_size then it says key value as none not expected
Источник: https://stackoverflow.com/questions/780 ... -in-python
def decrypt(self): if not os.path.exists(self.filename): raise Exception('File does not exist!') # Read the salt and HMAC digest from the separate file with open(self.filename + '.salt', 'rb') as file: k_sz = Fernet.key_size salt = file.read(k_sz) hmac_digest = file.read(hashlib.sha256().digest_size) here in the decrypt function i am trying to get the salt and hmac value stored in the encrypted file. But receiving the error
File "C:\python programs\test2.py", line 61, in decrypt k_sz = Fernet.key_size ^^^^^^^^^^^^^^^ AttributeError: type object 'Fernet' has no attribute 'key_size' i have tried .KEY_SIZE and Fernet(key=None).key_size then it says key value as none not expected
Источник: https://stackoverflow.com/questions/780 ... -in-python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Проблема с созданием ключа Fernet в Python с использованием библиотеки шифрования.
Anonymous » » в форуме Python - 0 Ответы
- 11 Просмотры
-
Последнее сообщение Anonymous
-