diff -ruN phpki-ng.old/phpki-ng-0.84/ca/manage_certs.php phpki-ng/phpki-ng-0.84/ca/manage_certs.php --- phpki-ng.old/phpki-ng-0.84/ca/manage_certs.php 2021-03-08 14:20:11.709778856 +0100 +++ phpki-ng/phpki-ng-0.84/ca/manage_certs.php 2021-03-08 14:19:11.400885516 +0100 @@ -254,7 +254,7 @@ - Certificate Password + Certificate Password diff -ruN phpki-ng.old/phpki-ng-0.84/ca/request_cert.php phpki-ng/phpki-ng-0.84/ca/request_cert.php --- phpki-ng.old/phpki-ng-0.84/ca/request_cert.php 2021-03-08 14:20:11.709778856 +0100 +++ phpki-ng/phpki-ng-0.84/ca/request_cert.php 2021-03-08 14:19:11.400885516 +0100 @@ -205,7 +205,7 @@ -

Are you sure?

+

Are you sure? After creation you will be returned to the Create Certificate dialogue.

@@ -258,10 +258,11 @@ break; } else { $serial = $errtxt; + // We could add 'return to index or create another certificate' } } } - + if ($submit == "Yes Create and Download") { switch ($cert_type) { case 'server': @@ -278,12 +279,12 @@ upload($config['pfx_dir'] . "/$serial.pfx", $rec['common_name'] . ".p12", 'application/x-pkcs12'); break; } - + # Clear common_name fields $common_name = ''; break; } - + # Clear common_name fields $common_name = ''; @@ -333,49 +334,57 @@ printHeader(); ?> - + - + "; + echo ""; + } + ?> - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff -ruN phpki-ng.old/phpki-ng-0.84/include/my_functions.php phpki-ng/phpki-ng-0.84/include/my_functions.php --- phpki-ng.old/phpki-ng-0.84/include/my_functions.php 2021-03-08 14:20:11.713778836 +0100 +++ phpki-ng/phpki-ng-0.84/include/my_functions.php 2021-03-08 14:19:11.400885516 +0100 @@ -270,7 +270,7 @@ # as a match is found. # -function eregi_array($regexp, $arr) +function preg_match_array($regexp, $arr) { foreach ($arr as $elem) { diff -ruN phpki-ng.old/phpki-ng-0.84/include/openssl_functions.php phpki-ng/phpki-ng-0.84/include/openssl_functions.php --- phpki-ng.old/phpki-ng-0.84/include/openssl_functions.php 2021-03-08 14:20:11.713778836 +0100 +++ phpki-ng/phpki-ng-0.84/include/openssl_functions.php 2021-03-08 14:19:11.400885516 +0100 @@ -601,7 +601,7 @@ $cmd_output[] = 'Revoking the certificate.'; $configCa_pwd = $config['ca_pwd']; $configOpenssl_cnf = $config['openssl_cnf']; - exec(CA." -config $configOpenssl_cnf -revoke ".escshellarg($certfile)." -passin pass:$ConfigCa_pwd 2>&1", $cmd_output, $ret); + exec(CA." -config $configOpenssl_cnf -revoke ".escshellarg($certfile)." -passin pass:$configCa_pwd 2>&1", $cmd_output, $ret); if ($ret == 0) { unset($cmd_output); @@ -836,13 +836,13 @@ #Unlock the CA database fclose($fd); - # https://github.com/radicand/phpki/issues/14 - if (preg_match('E-mail Protection', $certtext) && preg_match('Code Signing', $certtest)) { - $cert_type = 'email_signing'; - } - if (preg_match('E-mail Protection', $certtext)) { + //# https://github.com/radicand/phpki/issues/14 - but ereg is deprecated + if (preg_match('/E-mail Protection/', $certtext)) { $cert_type = 'email'; } + if (preg_match('/E-mail Protection/', $certtext) && preg_match('/Code Signing/', $certtext)) { + $cert_type = 'email_signing'; + } #Remove temporary openssl config file. if (file_exists($cnf_file)) { @@ -855,7 +855,7 @@ # Not successful, so clean up before exiting. CA_remove_cert($serial); - if (eregi_array('.*private key.*', $cmd_output)) { + if (preg_match_array('.*private key.*', $cmd_output)) { $cmd_output[] = 'This was likely caused by entering the wrong certificate password.'; } else { $cmd_output[] = 'Click on the "Help" link above for information on how to report this problem.'; @@ -946,27 +946,20 @@ $certtext = CA_cert_text($serial); - #if (ereg('OpenSSL.* (E.?mail|Personal) .*Certificate', $certtext) && ereg('Code Signing', $certtest)) { - if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext) && preg_match('~Code Signing~', $certtest)) { - $cert_type = 'email_codesigning'; - } - #if (ereg('OpenSSL.* (E.?mail|Personal) .*Certificate', $certtext)) { if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext)) { $cert_type = 'email'; - } #elseif (ereg('OpenSSL.* Server .*Certificate', $certtext)) { - elseif (preg_match('~OpenSSL.* Server .*Certificate~', $certtext)) { + } + if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext) && preg_match('~Code Signing~', $certtext)) { + $cert_type = 'email_signing'; // Was 'codesigning' but can't see that anywhere + } elseif (preg_match('~OpenSSL.* Server .*Certificate~', $certtext)) { $cert_type = 'server'; - } #elseif (ereg('timeStamping|Time Stamping', $certtext)) { - elseif (preg_match('~timeStamping|Time Stamping~', $certtext)) { + } elseif (preg_match('~timeStamping|Time Stamping~', $certtext)) { $cert_type = 'time_stamping'; - } #elseif (ereg('TLS Web Client Authentication', $certtext) && ereg('TLS Web Server Authentication', $certtext)) { - elseif (preg_match('~TLS Web Client Authentication~', $certtext) && preg_match('~TLS Web Server Authentication~', $certtext)) { + } elseif (preg_match('~TLS Web Client Authentication~', $certtext) && preg_match('~TLS Web Server Authentication~', $certtext)) { $cert_type = 'vpn_client_server'; - } #elseif (ereg('TLS Web Client Authentication', $certtext)) { - elseif (preg_match('~TLS Web Client Authentication~', $certtext)) { + } elseif (preg_match('~TLS Web Client Authentication~', $certtext)) { $cert_type = 'vpn_client'; - } #elseif (ereg('TLS Web Server Authentication', $certtext)) { - elseif (preg_match('~TLS Web Server Authentication~', $certtext)) { + } elseif (preg_match('~TLS Web Server Authentication~', $certtext)) { $cert_type = 'vpn_server'; } else { $cert_type = 'vpn_client_server';

Certificate Request Form

Previous Certificate Created successfully

$serial

Create another or go to back to the Menu

Menu
Common Name *
(i.e. User real name or computer hostname - used as SubjectAltName)
E-mail Address *
Organization (Company/Agency) *Organization(Company/Agency) *
Department/Unit *
Locality (City/County) *Locality(City/County) *
State/Province *
Country *
Certificate Password *
(Min 8 chars - Mandatory for Email,SSL Client,Code signing)
   Again +    Again + +
Certificate Life*
Key Size*
Certificate Use:* Alternative DNS Names
(only one per Line)