mirror of
https://github.com/certbot/certbot.git
synced 2026-06-03 13:59:02 -04:00
Serial number randomization with improved portability.
No exception handling required this time.
This commit is contained in:
parent
4759bc9034
commit
f7b10bb83e
1 changed files with 2 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
"""Crypto utilities."""
|
||||
import binascii
|
||||
import contextlib
|
||||
import logging
|
||||
import re
|
||||
|
|
@ -203,11 +204,7 @@ def gen_ss_cert(key, domains, not_before=None,
|
|||
"""
|
||||
assert domains, "Must provide one or more hostnames for the cert."
|
||||
cert = OpenSSL.crypto.X509()
|
||||
try:
|
||||
cert.set_serial_number(int(OpenSSL.rand.bytes(16).encode("hex"), 16))
|
||||
except AttributeError:
|
||||
# pylint: disable=E1101
|
||||
cert.set_serial_number(int.from_bytes(OpenSSL.rand.bytes(16), 'big'))
|
||||
cert.set_serial_number(int(binascii.hexlify(OpenSSL.rand.bytes(16)), 16))
|
||||
cert.set_version(2)
|
||||
|
||||
extensions = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue