Я пытаюсь зашифровать и расшифровать файлы библиотеки RSA. Мне всегда удается шифровать, но во время расшифровки я получаю ошибку переполнения. Я получаю исключение: «OverflowError: для сообщения требуется 64 байта, но есть место только для 53», вот код ниже;import rsa
pubkey,privekey= rsa.newkeys(512)
path = "C:\\Users\\PC\\Documents\\Document.rtf"
with open (path,'rb') as thefile:
contents = thefile.read()
contents_encryp = rsa.encrypt(contents,pubkey)
with open(path, 'wb') as thefile:
thefile.write(contents_encryp)
код расшифровки приведен ниже;
import rsa
from encryptor import contents_encryp,privekey
path = "C:\\Users\\PC\\Documents\\Document.rtf"
with open (path,'rb') as thefile:
contents = thefile.read()
contents_decryp = rsa.decrypt(contents_encryp,privekey)
with open(path, 'wb') as thefile:
thefile.write(contents_decryp)
Подробнее здесь: https://stackoverflow.com/questions/790 ... flow-error