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

(cherry picked from commit f6be07da74)
This commit is contained in:
Brad Warren
2017-09-20 10:35:32 -07:00
committed by GitHub
parent 49697b99d0
commit 7f5f6471fe
+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 = [