(cacert, cakey, end_certs)
Create end certificates
Create end certificates
Create end certificates
def create_end_certs(cacert, cakey, end_certs):
    """ Create end certificates """
    # Read current serial
    try:
        serial = int(open('serial.txt', 'r').read())
    except IOError:
        serial = 2

    # Create certificates
    notbefore, notafter = generate_dates()
    for name in end_certs:
        common_name = name + '.' + DOMAIN_NAME
        cert, key = create_sub_cert(
            common_name, cacert, cakey, serial, notbefore, notafter)
        writeout_cert_and_key('certs/', name, cert, key)
        create_pkcs12('pkcs12/', common_name, cert, key, cacert)
        create_mobileconfig(name)
        serial += 1

    # Write new serial
    with open('serial.txt', 'w') as fhn:
        fhn.write(str(serial))
def create_end_certs ( cacert , cakey , end_certs ) : # Read current serial try : serial = int ( open ( 'serial.txt' , 'r' ) . read ( ) ) except IOError : serial = 2 # Create certificates notbefore , notafter = generate_dates ( ) for name in end_certs : common_name = name + '.' + DOMAIN_NAME cert , key = create_sub_cert ( common_name , cacert , cakey , serial , notbefore , notafter ) writeout_cert_and_key ( 'certs/' , name , cert , key ) create_pkcs12 ( 'pkcs12/' , common_name , cert , key , cacert ) create_mobileconfig ( name ) serial += 1 # Write new serial with open ( 'serial.txt' , 'w' ) as fhn : fhn . write ( str ( serial ) )