[certificats] Typo sur la génération de CSR
This commit is contained in:
parent
f98c949e2e
commit
0922602a76
2 changed files with 16 additions and 3 deletions
|
@ -189,10 +189,10 @@ def createCertRequest(pkey, digest="sha1", subjectAltName=[], **name):
|
||||||
subj = req.get_subject()
|
subj = req.get_subject()
|
||||||
for (key,value) in name.items():
|
for (key,value) in name.items():
|
||||||
setattr(subj, key, value)
|
setattr(subj, key, value)
|
||||||
|
exts = []
|
||||||
if subjectAltName:
|
if subjectAltName:
|
||||||
exts = []
|
exts.append(crypto.X509Extension("subjectAltName", False, ", ".join(["DNS:%s" % altName for altName in subjectAltName])))
|
||||||
for altName in subjectAltName:
|
if exts:
|
||||||
exts.append(crypto.X509Extension("subjectAltName", True, "DNS:%s" % altName))
|
|
||||||
req.add_extensions(exts)
|
req.add_extensions(exts)
|
||||||
req.set_pubkey(pkey)
|
req.set_pubkey(pkey)
|
||||||
req.sign(pkey, digest)
|
req.sign(pkey, digest)
|
||||||
|
|
|
@ -15,6 +15,8 @@ import tempfile
|
||||||
import traceback
|
import traceback
|
||||||
if '/usr/scripts' not in sys.path:
|
if '/usr/scripts' not in sys.path:
|
||||||
sys.path.append('/usr/scripts')
|
sys.path.append('/usr/scripts')
|
||||||
|
import gestion.secrets_new as secrets
|
||||||
|
|
||||||
from OpenSSL import crypto, SSL
|
from OpenSSL import crypto, SSL
|
||||||
|
|
||||||
from gestion.cert_utils import createCertRequest
|
from gestion.cert_utils import createCertRequest
|
||||||
|
@ -232,6 +234,17 @@ les valeurs valident sont :
|
||||||
|
|
||||||
def gen_csr(self, certificat, cont):
|
def gen_csr(self, certificat, cont):
|
||||||
"""Permet de générer un csr à partir de la clef privée du certificat"""
|
"""Permet de générer un csr à partir de la clef privée du certificat"""
|
||||||
|
def box(text):
|
||||||
|
fp, path = tempfile.mkstemp()
|
||||||
|
os.write(fp, text)
|
||||||
|
os.close(fp)
|
||||||
|
self.dialog.textbox(filename=path, height=0, width=0,
|
||||||
|
backtitle="Appuyez sur CTRL+MAJ+V pour coller",
|
||||||
|
title="Récupération d'un certificat",
|
||||||
|
no_mouse=True, timeout=self.timeout,)
|
||||||
|
os.remove(path)
|
||||||
|
return
|
||||||
|
|
||||||
def todo(certificat, self_cont, cont):
|
def todo(certificat, self_cont, cont):
|
||||||
if certificat['encrypted']:
|
if certificat['encrypted']:
|
||||||
if "machineCrans" in certificat.machine()["objectClass"]:
|
if "machineCrans" in certificat.machine()["objectClass"]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue