m32 / endesive

en-crypt, de-crypt, si-gn, ve-rify - smime, pdf, xades and plain files in pure python
MIT License
239 stars 92 forks source link

AttributeError: 'Certificate' object has no attribute 'public_bytes' #46

Closed vraj72 closed 4 years ago

vraj72 commented 4 years ago

Traceback (most recent call last): File "s4.py", line 36, in main() File "s4.py", line 31, in main datas = pdf.cms.sign(datau, dct, p12[0], p12[1], [], 'sha256') File "/home/viraj/anaconda3/lib/python3.6/site-packages/endesive-1.4.4-py3.6.egg/endesive/pdf/cms.py", line 384, in sign return cls.sign(datau, udct, key, cert, othercerts, algomd, hsm, timestampurl) File "/home/viraj/anaconda3/lib/python3.6/site-packages/endesive-1.4.4-py3.6.egg/endesive/pdf/cms.py", line 375, in sign contents = signer.sign(None, key, cert, othercerts, algomd, True, md, hsm, False, timestampurl) File "/home/viraj/anaconda3/lib/python3.6/site-packages/endesive-1.4.4-py3.6.egg/endesive/signer.py", line 38, in sign cert = cert2asn(cert) File "/home/viraj/anaconda3/lib/python3.6/site-packages/endesive-1.4.4-py3.6.egg/endesive/signer.py", line 22, in cert2asn cert_bytes = cert.public_bytes(serialization.Encoding.PEM) AttributeError: 'Certificate' object has no attribute 'public_bytes'

m32 commented 4 years ago

p12 must be the result of the function pkcs12 imported from cryptography.hazmat.primitives.serialization Have you seen the examples in the examples directory?

saifullah5302411224 commented 4 years ago

i get error if run examples=> pdf-sign-cms.py too much error: Traceback (most recent call last): File "pdf-sign-cms.py", line 49, in main() File "pdf-sign-cms.py", line 37, in main datas = pdf.cms.sign(datau, dct, File "C:\Python38\lib\site-packages\endesive\pdf\cms.py", line 501, in sign return cls.sign(datau, udct, key, cert, othercerts, algomd, hsm, timestampurl) File "C:\Python38\lib\site-packages\endesive\pdf\cms.py", line 399, in sign self.makepdf(prev, udct, algomd, zeros) File "C:\Python38\lib\site-packages\endesive\pdf\cms.py", line 234, in makepdf from endesive.pdf.PyPDF2_annotate.annotations.text import FreeText File "C:\Python38\lib\site-packages\endesive\pdf\PyPDF2_annotate__init__.py", line 2, in from .annotator import PdfAnnotator File "C:\Python38\lib\site-packages\endesive\pdf\PyPDF2_annotate\annotator.py", line 15, in from .annotations.image import Image File "C:\Python38\lib\site-packages\endesive\pdf\PyPDF2_annotate\annotations\image.py", line 19, in from .rect import RectAnnotation File "C:\Python38\lib\site-packages\endesive\pdf\PyPDF2_annotate\annotations\rect.py", line 13, in from ..config.appearance import set_appearance_state File "C:\Python38\lib\site-packages\endesive\pdf\PyPDF2_annotate\config\appearance.py", line 10, in import attr ModuleNotFoundError: No module named 'attr'

m32 commented 4 years ago

dpendencies updated in setup.py