def _create_certificate_chain():
    '\n    Construct and return a chain of certificates.\n\n        1. A new self-signed certificate authority certificate (cacert)\n        2. A new intermediate certificate signed by cacert (icert)\n        3. A new server certificate signed by icert (scert)\n    '
    caext = X509Extension(b'basicConstraints', False, b'CA:true')
    cakey = PKey()
    cakey.generate_key(TYPE_RSA, 1024)
    cacert = X509()
    cacert.get_subject().commonName = 'Authority Certificate'
    cacert.set_issuer(cacert.get_subject())
    cacert.set_pubkey(cakey)
    cacert.set_notBefore(b'20000101000000Z')
    cacert.set_notAfter(b'20200101000000Z')
    cacert.add_extensions([caext])
    cacert.set_serial_number(0)
    cacert.sign(cakey, 'sha1')
    ikey = PKey()
    ikey.generate_key(TYPE_RSA, 1024)
    icert = X509()
    icert.get_subject().commonName = 'Intermediate Certificate'
    icert.set_issuer(cacert.get_subject())
    icert.set_pubkey(ikey)
    icert.set_notBefore(b'20000101000000Z')
    icert.set_notAfter(b'20200101000000Z')
    icert.add_extensions([caext])
    icert.set_serial_number(0)
    icert.sign(cakey, 'sha1')
    skey = PKey()
    skey.generate_key(TYPE_RSA, 1024)
    scert = X509()
    scert.get_subject().commonName = 'Server Certificate'
    scert.set_issuer(icert.get_subject())
    scert.set_pubkey(skey)
    scert.set_notBefore(b'20000101000000Z')
    scert.set_notAfter(b'20200101000000Z')
    scert.add_extensions([X509Extension(b'basicConstraints', True, b'CA:false')])
    scert.set_serial_number(0)
    scert.sign(ikey, 'sha1')
    return [(cakey, cacert), (ikey, icert), (skey, scert)]
Construct and return a chain of certificates.

    1. A new self-signed certificate authority certificate (cacert)
    2. A new intermediate certificate signed by cacert (icert)
    3. A new server certificate signed by icert (scert)
def _create_certificate_chain():
    '\n    Construct and return a chain of certificates.\n\n        1. A new self-signed certificate authority certificate (cacert)\n        2. A new intermediate certificate signed by cacert (icert)\n        3. A new server certificate signed by icert (scert)\n    '
    caext = X509Extension(b'basicConstraints', False, b'CA:true')
    cakey = PKey()
    cakey.generate_key(TYPE_RSA, 1024)
    cacert = X509()
    cacert.get_subject().commonName = 'Authority Certificate'
    cacert.set_issuer(cacert.get_subject())
    cacert.set_pubkey(cakey)
    cacert.set_notBefore(b'20000101000000Z')
    cacert.set_notAfter(b'20200101000000Z')
    cacert.add_extensions([caext])
    cacert.set_serial_number(0)
    cacert.sign(cakey, 'sha1')
    ikey = PKey()
    ikey.generate_key(TYPE_RSA, 1024)
    icert = X509()
    icert.get_subject().commonName = 'Intermediate Certificate'
    icert.set_issuer(cacert.get_subject())
    icert.set_pubkey(ikey)
    icert.set_notBefore(b'20000101000000Z')
    icert.set_notAfter(b'20200101000000Z')
    icert.add_extensions([caext])
    icert.set_serial_number(0)
    icert.sign(cakey, 'sha1')
    skey = PKey()
    skey.generate_key(TYPE_RSA, 1024)
    scert = X509()
    scert.get_subject().commonName = 'Server Certificate'
    scert.set_issuer(icert.get_subject())
    scert.set_pubkey(skey)
    scert.set_notBefore(b'20000101000000Z')
    scert.set_notAfter(b'20200101000000Z')
    scert.add_extensions([X509Extension(b'basicConstraints', True, b'CA:false')])
    scert.set_serial_number(0)
    scert.sign(ikey, 'sha1')
    return [(cakey, cacert), (ikey, icert), (skey, scert)]