Hello,
I'm fighting with Certificate Authority functionality with python
I stuck on following problem: How to sign CSR using CA key and write
resulted certificate.
You can do it using following openssl cmd:
openssl ca -cert CA/cert.pem -keyfile CA/private/cakey.pem -policy
policy_anything -out user_cert.pem -infiles userreq.pem
My try was:
import OpenSSL.crypto as pki
#load CA key:
ca_key=pki.load _privatekey(pki .FILETYPE_PEM,o pen('CA/private/
cakey.pem').rea d(),'haselko')
#load user's csr:
csr=pki.load_ce rtificate_reque st(pki.FILETYPE _PEM,open('user req.pem').read( ))
# sign csr
csr.sign(ca_key ,'sha1')
I don't get any erorrs however I dont' see any way to write or get
result from such operation
csr exports following methods:
csr.add_extensi ons csr.get_pubkey csr.get_subject
csr.set_pubkey csr.sign csr.verify
I want to create pure python implementation without use of openssl
wrapped with python code.
Regards,
I'm fighting with Certificate Authority functionality with python
I stuck on following problem: How to sign CSR using CA key and write
resulted certificate.
You can do it using following openssl cmd:
openssl ca -cert CA/cert.pem -keyfile CA/private/cakey.pem -policy
policy_anything -out user_cert.pem -infiles userreq.pem
My try was:
import OpenSSL.crypto as pki
#load CA key:
ca_key=pki.load _privatekey(pki .FILETYPE_PEM,o pen('CA/private/
cakey.pem').rea d(),'haselko')
#load user's csr:
csr=pki.load_ce rtificate_reque st(pki.FILETYPE _PEM,open('user req.pem').read( ))
# sign csr
csr.sign(ca_key ,'sha1')
I don't get any erorrs however I dont' see any way to write or get
result from such operation
csr exports following methods:
csr.add_extensi ons csr.get_pubkey csr.get_subject
csr.set_pubkey csr.sign csr.verify
I want to create pure python implementation without use of openssl
wrapped with python code.
Regards,
Comment