Я хочу прочитать все PDF-файлы и добавить в них файл .cer, подписать PDF-файлы цифровой подписью с сертификатом. Добавление или удаление "encoding = 'utf-8'" не имеет значения.
import OpenSSL
cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1,
open('digital_sig/tci.cer', encoding='utf-8').read())
ERROR:
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-7-fc2a32e67543> in <module>()
2
3 cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1,
----> 4 open('digital_sig/tci.cer', encoding='utf-8').read())
~\Anaconda3\lib\codecs.py in decode(self, input, final)
320 # decode input (taking the buffer into account)
321 data = self.buffer + input
--> 322 (result, consumed) = self._buffer_decode(data, self.errors, final)
323 # keep undecoded input until the next call
324 self.buffer = data[consumed:]
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 1: invalid start byte