fix #5111 AttributeError occured with >=pyOpenSSL-17.2.0 (#5112)

This commit is contained in:
Seong-ho Cho
2017-09-15 16:57:10 -07:00
committed by Brad Warren
parent 7c16e0da26
commit f6be07da74
+2 -1
View File
@@ -2,6 +2,7 @@
import binascii
import contextlib
import logging
import os
import re
import socket
import sys
@@ -243,7 +244,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()
cert.set_serial_number(int(binascii.hexlify(OpenSSL.rand.bytes(16)), 16))
cert.set_serial_number(int(binascii.hexlify(os.urandom(16)), 16))
cert.set_version(2)
extensions = [