function create_ca($my_certstore_path, $my_device_type, $my_cert_dn, $my_passphrase)
{
    //if (!is_dir($my_certstore_path.$my_cert_dn['commonName']))
    create_cert_store($my_certstore_path, $my_cert_dn['commonName']);
    //else
    //  die('Fatal: CA Store already exists for '. $my_cert_dn['commonName']);
    $my_days = $my_cert_dn['days'];
    $my_keysize = $my_cert_dn['keySize'];
    unset($my_cert_dn['days']);
    unset($my_cert_dn['keySize']);
    $my_csrfile = create_csr($my_cert_dn, $my_keysize, $my_passphrase, $my_device_type);
    sign_csr($my_passphrase, $my_csrfile, $my_days, $my_device_type);
    //to do, check sign_csr code for device type
}
     upload_csr_form();
     printFooter();
     break;
 case "upload_CSR":
     printHeader('Upload a CSR');
     upload_csr($_FILES['uploadedfile']);
     printFooter();
     break;
 case "sign_csr_form":
     printHeader('Signing CSR');
     sign_csr_form();
     printFooter();
     break;
 case "sign_csr":
     printHeader('Signing CSR');
     sign_csr($_POST['pass'], $_POST['csr_name'], $_POST['days'], $_POST['device_type']);
     printFooter();
     break;
 case "setup_certstore_form":
     printHeader('Setup CA Certificate Store');
     setup_certstore_form();
     break;
 case "setup_certstore":
     printHeader('Setup CA Certificate Store');
     setup_certstore($_POST['certstore_path']);
     break;
 case "create_ca_form":
     printHeader('Creating new Root CA - Part 1');
     create_ca_form();
     break;
 case "create_ca":