mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 00:35:50 +02:00
Serial number randomization with improved portability.
No exception handling required this time.
This commit is contained in:
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user