summaryrefslogtreecommitdiff
path: root/pages/account/6.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/account/6.php')
-rw-r--r--pages/account/6.php70
1 files changed, 1 insertions, 69 deletions
diff --git a/pages/account/6.php b/pages/account/6.php
index b8efdce..3c3794c 100644
--- a/pages/account/6.php
+++ b/pages/account/6.php
@@ -34,72 +34,4 @@ if(mysql_num_rows($res) <= 0) {
}
$row = mysql_fetch_assoc($res);
-
-if (array_key_exists('format', $_REQUEST)) {
- // Which output format?
- if ($_REQUEST['format'] === 'der') {
- $outform = '-outform DER';
- $extension = 'cer';
- } else {
- $outform = '-outform PEM';
- $extension = 'crt';
- }
-
- $crtname=escapeshellarg($row['crt_name']);
- $cert = `/usr/bin/openssl x509 -in $crtname $outform`;
-
- header("Content-Type: application/pkix-cert");
- header("Content-Length: ".strlen($cert));
-
- $fname = sanitizeFilename($row['CN']);
- if ($fname=="") $fname="certificate";
- header("Content-Disposition: attachment; filename=\"${fname}.${extension}\"");
-
- echo $cert;
- exit;
-
-} elseif (array_key_exists('install', $_REQUEST)) {
- if (array_key_exists('HTTP_USER_AGENT',$_SERVER) &&
- strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
-
- // Handle IE
- //TODO
-
- } else {
- // All other browsers
- $crtname=escapeshellarg($row['crt_name']);
- $cert = `/usr/bin/openssl x509 -in $crtname -outform DER`;
-
- header("Content-Type: application/x-x509-user-cert");
- header("Content-Length: ".strlen($cert));
-
- $fname = sanitizeFilename($row['CN']);
- if ($fname=="") $fname="certificate";
- header("Content-Disposition: inline; filename=\"${fname}.cer\"");
-
- echo $cert;
- exit;
- }
-
-} else {
- showheader(_("My CAcert.org Account!"), _("Install your certificate"));
- echo '<ul class="no_indent">';
- echo "<li><a href='account.php?id=$id&amp;cert=$certid&amp;install'>".
- _("Install the certificate into your browser").
- "</a></li>\n";
-
- echo "<li><a href='account.php?id=$id&amp;cert=$certid&amp;format=pem'>".
- _("Download the certificate in PEM format")."</a></li>\n";
-
- echo "<li><a href='account.php?id=$id&amp;cert=$certid&amp;format=der'>".
- _("Download the certificate in DER format")."</a></li>\n";
- echo '</ul>';
-
- // Allow to directly copy and paste the cert in PEM format
- $crtname=escapeshellarg($row['crt_name']);
- $cert = `/usr/bin/openssl x509 -in $crtname -outform PEM`;
- echo "<pre>$cert</pre>";
-
- showfooter();
- exit;
-}
+show_client_cert($row['crt_name'], "account.php?id=$id&amp;cert=$certid", $row['CN']);