Python library for digital signing and verification of digital signatures in 
mail, PDF and XML documents.

The ASN.1 implementation depends on asn1crypto. Cryptographic routines depend 
on oscrypto and cryptography libraries, so everything is 'pure python'.

For certificate verification OpenSSL is used but I would not trust it, next 
version should switch to certvalidator or cryptography.

This library implements S/MIME handler which can encrypt and decrypt S/MIME 
messages using a public RSA key, in AES-128/192/256 CBC/OFB modes. It can also 
sign and verify S/MIME messages.

This library implements CAdES-B handler for signing and verifying PDF documents 
in Adobe.PPKLite/adbe.pkcs7.detached form. It can sign documents during 
generation using a modified version of pyfpdf which is included in this 
library. It can also sign documents generated by external programms.

This library implements XADES-BES handler for creating signed xml files.

This library implements CMS handler for signing and verifying plain text files 
with detached signature files.

This software is licensed under the MIT License.

https://github.com/m32/endesive

#!/usr/bin/env python3
# *-* coding: utf-8 *-*
from oscrypto import asymmetric

from endesive import pdf


def main():
    dct = {
        b'sigflags': 3,
        b'contact': b'u...@email.com',
        b'location': b'Szczecin',
        b'signingdate': b'20180731082642+02\'00\'',
        b'reason': b'Dokument podpisany cyfrowo',
    }
    p12 = asymmetric.load_pkcs12(open('demo2_user1.p12', 'rb').read(), '1234')
    datau = open('pdf.pdf', 'rb').read()
    datas = pdf.cms.sign(datau, dct, p12[0], p12[1], [], 'sha256')
    with open('pdf-signed-cms.pdf', 'wb') as fp:
        fp.write(datau)
        fp.write(datas)


main()
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

        Support the Python Software Foundation:
        http://www.python.org/psf/donations/

Reply via email to