Revision be065c25
Added by Jim Pingle over 13 years ago
usr/local/www/system_certmanager.php | ||
---|---|---|
144 | 144 |
exit; |
145 | 145 |
} |
146 | 146 |
|
147 |
if ($act == "p12") { |
|
148 |
if (!$a_cert[$id]) { |
|
149 |
pfSenseHeader("system_certmanager.php"); |
|
150 |
exit; |
|
151 |
} |
|
152 |
|
|
153 |
$exp_name = urlencode("{$a_cert[$id]['descr']}.p12"); |
|
154 |
|
|
155 |
$res_crt = openssl_x509_read(base64_decode($a_cert[$id]['crt'])); |
|
156 |
$res_key = openssl_pkey_get_private(array(0 => base64_decode($a_cert[$id]['prv']) , 1 => "")); |
|
157 |
|
|
158 |
$exp_data = ""; |
|
159 |
openssl_pkcs12_export($res_crt, $exp_data, $res_key, null); |
|
160 |
$exp_size = strlen($exp_data); |
|
161 |
|
|
162 |
header("Content-Type: application/octet-stream"); |
|
163 |
header("Content-Disposition: attachment; filename={$exp_name}"); |
|
164 |
header("Content-Length: $exp_size"); |
|
165 |
echo $exp_data; |
|
166 |
exit; |
|
167 |
} |
|
168 |
|
|
147 | 169 |
if ($act == "csr") { |
148 | 170 |
|
149 | 171 |
if (!$a_cert[$id]) { |
... | ... | |
953 | 975 |
<a href="system_certmanager.php?act=key&id=<?=$i;?>"> |
954 | 976 |
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export key");?>" alt="<?=gettext("export ca");?>" width="17" height="17" border="0" /> |
955 | 977 |
</a> |
978 |
<a href="system_certmanager.php?act=p12&id=<?=$i;?>"> |
|
979 |
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export cert+key in .p12");?>" alt="<?=gettext("export cert+key in .p12");?>" width="17" height="17" border="0" /> |
|
980 |
</a> |
|
956 | 981 |
<?php if (!cert_in_use($cert['refid'])): ?> |
957 | 982 |
<a href="system_certmanager.php?act=del&id=<?=$i;?>" onClick="return confirm('<?=gettext("Do you really want to delete this Certificate?");?>')"> |
958 | 983 |
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete cert");?>" alt="<?=gettext("delete cert");?>" width="17" height="17" border="0" /> |
Also available in: Unified diff
Add button to download a .p12 of a cert+key. Implements #2147