41 |
41 |
require_once("certs.inc");
|
42 |
42 |
|
43 |
43 |
$cert_methods = array(
|
44 |
|
"existing" => "Import an existing Certificate",
|
45 |
|
"internal" => "Create an internal Certificate",
|
46 |
|
"external" => "Create a Certificate Signing Request");
|
|
44 |
"existing" => gettext("Import an existing Certificate"),
|
|
45 |
"internal" => gettext("Create an internal Certificate"),
|
|
46 |
"external" => gettext("Create a Certificate Signing Request"));
|
47 |
47 |
|
48 |
48 |
$cert_keylens = array( "512", "1024", "2048", "4096");
|
49 |
49 |
|
50 |
|
$pgtitle = array("System", "Certificate Manager");
|
|
50 |
$pgtitle = array("System", gettext("Certificate Manager"));
|
51 |
51 |
|
52 |
52 |
$id = $_GET['id'];
|
53 |
53 |
if (isset($_POST['id']))
|
... | ... | |
151 |
151 |
$reqdfields = explode(" ",
|
152 |
152 |
"name cert key");
|
153 |
153 |
$reqdfieldsn = explode(",",
|
154 |
|
"Descriptive name,Certificate data,Key data");
|
|
154 |
gettext("Descriptive name,Certificate data,Key data"));
|
155 |
155 |
}
|
156 |
156 |
|
157 |
157 |
if ($pconfig['method'] == "internal") {
|
... | ... | |
159 |
159 |
"name caref keylen lifetime dn_country dn_state dn_city ".
|
160 |
160 |
"dn_organization dn_email dn_commonname");
|
161 |
161 |
$reqdfieldsn = explode(",",
|
162 |
|
"Descriptive name,Certificate authority,Key length,Lifetime,".
|
163 |
|
"Distinguished name Country Code,".
|
164 |
|
"Distinguished name State or Province,".
|
165 |
|
"Distinguished name City,".
|
166 |
|
"Distinguished name Organization,".
|
167 |
|
"Distinguished name Email Address,".
|
168 |
|
"Distinguished name Common Name");
|
|
162 |
gettext("Descriptive name,Certificate authority,Key length,Lifetime,").
|
|
163 |
gettext("Distinguished name Country Code,").
|
|
164 |
gettext("Distinguished name State or Province,").
|
|
165 |
gettext("Distinguished name City,").
|
|
166 |
gettext("Distinguished name Organization,").
|
|
167 |
gettext("Distinguished name Email Address,").
|
|
168 |
gettext("Distinguished name Common Name"));
|
169 |
169 |
}
|
170 |
170 |
|
171 |
171 |
if ($pconfig['method'] == "external") {
|
... | ... | |
173 |
173 |
"name csr_keylen csr_dn_country csr_dn_state csr_dn_city ".
|
174 |
174 |
"csr_dn_organization csr_dn_email csr_dn_commonname");
|
175 |
175 |
$reqdfieldsn = explode(",",
|
176 |
|
"Descriptive name,Key length,".
|
177 |
|
"Distinguished name Country Code,".
|
178 |
|
"Distinguished name State or Province,".
|
179 |
|
"Distinguished name City,".
|
180 |
|
"Distinguished name Organization,".
|
181 |
|
"Distinguished name Email Address,".
|
182 |
|
"Distinguished name Common Name");
|
|
176 |
gettext("Descriptive name,Key length,").
|
|
177 |
gettext("Distinguished name Country Code,").
|
|
178 |
gettext("Distinguished name State or Province,").
|
|
179 |
gettext("Distinguished name City,").
|
|
180 |
gettext("Distinguished name Organization,").
|
|
181 |
gettext("Distinguished name Email Address,").
|
|
182 |
gettext("Distinguished name Common Name"));
|
183 |
183 |
}
|
184 |
184 |
|
185 |
185 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
... | ... | |
239 |
239 |
}
|
240 |
240 |
}
|
241 |
241 |
|
242 |
|
if ($_POST['save'] == "Update") {
|
|
242 |
if ($_POST['save'] == gettext("Update")) {
|
243 |
243 |
unset($input_errors);
|
244 |
244 |
$pconfig = $_POST;
|
245 |
245 |
|
246 |
246 |
/* input validation */
|
247 |
247 |
$reqdfields = explode(" ", "name cert");
|
248 |
|
$reqdfieldsn = explode(",", "Descriptive name,Final Certificate data");
|
|
248 |
$reqdfieldsn = explode(",", gettext("Descriptive name,Final Certificate data"));
|
249 |
249 |
|
250 |
250 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
251 |
251 |
|
... | ... | |
254 |
254 |
$subj_cert = cert_get_subject($pconfig['cert'], false);
|
255 |
255 |
|
256 |
256 |
if (strcmp($subj_csr,$subj_cert))
|
257 |
|
$input_errors[] = gettext("The certificate subject '{$subj_cert}' does not match the signing request subject.");
|
|
257 |
$input_errors[] = sprintf(gettext("The certificate subject '%s' does not match the signing request subject."),$subj_cert);
|
258 |
258 |
|
259 |
259 |
/* if this is an AJAX caller then handle via JSON */
|
260 |
260 |
if (isAjax() && is_array($input_errors)) {
|
... | ... | |
402 |
402 |
<td colspan="2" class="list" height="12"></td>
|
403 |
403 |
</tr>
|
404 |
404 |
<tr>
|
405 |
|
<td colspan="2" valign="top" class="listtopic">Existing Certificate</td>
|
|
405 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("Existing Certificate");?></td>
|
406 |
406 |
</tr>
|
407 |
407 |
|
408 |
408 |
<tr>
|
409 |
|
<td width="22%" valign="top" class="vncellreq">Certificate data</td>
|
|
409 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate data");?></td>
|
410 |
410 |
<td width="78%" class="vtable">
|
411 |
411 |
<textarea name="cert" id="cert" cols="65" rows="7" class="formfld_cert"><?=$pconfig['cert'];?></textarea>
|
412 |
412 |
<br>
|
413 |
|
Paste a certificate in X.509 PEM format here.</td>
|
|
413 |
<?=gettext("Paste a certificate in X.509 PEM format here.");?></td>
|
414 |
414 |
</td>
|
415 |
415 |
</tr>
|
416 |
416 |
<tr>
|
417 |
|
<td width="22%" valign="top" class="vncellreq">Private key data</td>
|
|
417 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Private key data");?></td>
|
418 |
418 |
<td width="78%" class="vtable">
|
419 |
419 |
<textarea name="key" id="key" cols="65" rows="7" class="formfld_cert"><?=$pconfig['key'];?></textarea>
|
420 |
420 |
<br>
|
421 |
|
Paste a private key in X.509 PEM format here.</td>
|
|
421 |
<?=gettext("Paste a private key in X.509 PEM format here.");?></td>
|
422 |
422 |
</td>
|
423 |
423 |
</tr>
|
424 |
424 |
</table>
|
... | ... | |
428 |
428 |
<td colspan="2" class="list" height="12"></td>
|
429 |
429 |
</tr>
|
430 |
430 |
<tr>
|
431 |
|
<td colspan="2" valign="top" class="listtopic">Internal Certificate</td>
|
|
431 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("Internal Certificate");?></td>
|
432 |
432 |
</tr>
|
433 |
433 |
|
434 |
434 |
<?php if (!$internal_ca_count): ?>
|
435 |
435 |
|
436 |
436 |
<tr>
|
437 |
437 |
<td colspan="2" align="center" class="vtable">
|
438 |
|
No internal Certificate Authorities have been defined. You must
|
439 |
|
<a href="system_camanager.php?act=new&method=internal">create</a>
|
440 |
|
an internal CA before creating an internal certificate.
|
|
438 |
<?=gettext("No internal Certificate Authorities have been defined. You must");?>
|
|
439 |
<a href="system_camanager.php?act=new&method=internal"><?=gettext("create");?></a>
|
|
440 |
<?=gettext("an internal CA before creating an internal certificate.");?>
|
441 |
441 |
</td>
|
442 |
442 |
</tr>
|
443 |
443 |
|
... | ... | |
473 |
473 |
<option value="<?=$len;?>"<?=$selected;?>><?=$len;?></option>
|
474 |
474 |
<?php endforeach; ?>
|
475 |
475 |
</select>
|
476 |
|
bits
|
|
476 |
<?=gettext("bits");?>
|
477 |
477 |
</td>
|
478 |
478 |
</tr>
|
479 |
479 |
<tr>
|
480 |
480 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Lifetime");?></td>
|
481 |
481 |
<td width="78%" class="vtable">
|
482 |
482 |
<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['lifetime']);?>"/>
|
483 |
|
days
|
|
483 |
<?=gettext("days");?>
|
484 |
484 |
</td>
|
485 |
485 |
</tr>
|
486 |
486 |
<tr>
|
... | ... | |
488 |
488 |
<td width="78%" class="vtable">
|
489 |
489 |
<table border="0" cellspacing="0" cellpadding="2">
|
490 |
490 |
<tr>
|
491 |
|
<td align="right">Country Code : </td>
|
|
491 |
<td align="right"><?=gettext("Country Code");?> : </td>
|
492 |
492 |
<td align="left">
|
493 |
493 |
<input name="dn_country" type="text" class="formfld unknown" maxlength="2" size="2" value="<?=htmlspecialchars($pconfig['dn_country']);?>" readonly/>
|
494 |
494 |
</td>
|
495 |
495 |
</tr>
|
496 |
496 |
<tr>
|
497 |
|
<td align="right">State or Province : </td>
|
|
497 |
<td align="right"><?=gettext("State or Province");?> : </td>
|
498 |
498 |
<td align="left">
|
499 |
499 |
<input name="dn_state" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['dn_state']);?>" readonly/>
|
500 |
500 |
</td>
|
501 |
501 |
</tr>
|
502 |
502 |
<tr>
|
503 |
|
<td align="right">City : </td>
|
|
503 |
<td align="right"><?=gettext("City");?> : </td>
|
504 |
504 |
<td align="left">
|
505 |
505 |
<input name="dn_city" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['dn_city']);?>" readonly/>
|
506 |
506 |
</td>
|
507 |
507 |
</tr>
|
508 |
508 |
<tr>
|
509 |
|
<td align="right">Organization : </td>
|
|
509 |
<td align="right"><?=gettext("Organization");?> : </td>
|
510 |
510 |
<td align="left">
|
511 |
511 |
<input name="dn_organization" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['dn_organization']);?>" readonly/>
|
512 |
512 |
</td>
|
513 |
513 |
</tr>
|
514 |
514 |
<tr>
|
515 |
|
<td align="right">Email Address : </td>
|
|
515 |
<td align="right"><?=gettext("Email Address");?> : </td>
|
516 |
516 |
<td align="left">
|
517 |
517 |
<input name="dn_email" type="text" class="formfld unknown" size="25" value="<?=htmlspecialchars($pconfig['dn_email']);?>"/>
|
518 |
518 |
|
519 |
519 |
<em>ex:</em>
|
520 |
520 |
|
521 |
|
webadmin@mycompany.com
|
|
521 |
<?=gettext("webadmin@mycompany.com");?>
|
522 |
522 |
</td>
|
523 |
523 |
</tr>
|
524 |
524 |
<tr>
|
525 |
|
<td align="right">Common Name : </td>
|
|
525 |
<td align="right"><?=gettext("Common Name");?> : </td>
|
526 |
526 |
<td align="left">
|
527 |
527 |
<input name="dn_commonname" type="text" class="formfld unknown" size="25" value="<?=htmlspecialchars($pconfig['dn_commonname']);?>"/>
|
528 |
528 |
|
529 |
529 |
<em>ex:</em>
|
530 |
530 |
|
531 |
|
www.example.com
|
|
531 |
<?=gettext("www.example.com");?>
|
532 |
532 |
</td>
|
533 |
533 |
</tr>
|
534 |
534 |
</table>
|
... | ... | |
544 |
544 |
<td colspan="2" class="list" height="12"></td>
|
545 |
545 |
</tr>
|
546 |
546 |
<tr>
|
547 |
|
<td colspan="2" valign="top" class="listtopic">External Signing Request</td>
|
|
547 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("External Signing Request");?></td>
|
548 |
548 |
</tr>
|
549 |
549 |
<tr>
|
550 |
550 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Key length");?></td>
|
... | ... | |
567 |
567 |
<td width="78%" class="vtable">
|
568 |
568 |
<table border="0" cellspacing="0" cellpadding="2">
|
569 |
569 |
<tr>
|
570 |
|
<td align="right">Country Code : </td>
|
|
570 |
<td align="right"><?=gettext("Country Code");?> : </td>
|
571 |
571 |
<td align="left">
|
572 |
572 |
<input name="csr_dn_country" type="text" class="formfld unknown" size="2" value="<?=htmlspecialchars($pconfig['csr_dn_country']);?>" />
|
573 |
573 |
|
... | ... | |
575 |
575 |
|
576 |
576 |
US
|
577 |
577 |
|
578 |
|
<em>( two letters )</em>
|
|
578 |
<em><?=gettext("( two letters )");?></em>
|
579 |
579 |
</td>
|
580 |
580 |
</tr>
|
581 |
581 |
<tr>
|
582 |
|
<td align="right">State or Province : </td>
|
|
582 |
<td align="right"><?=gettext("State or Province");?> : </td>
|
583 |
583 |
<td align="left">
|
584 |
584 |
<input name="csr_dn_state" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['csr_dn_state']);?>" />
|
585 |
585 |
|
586 |
586 |
<em>ex:</em>
|
587 |
587 |
|
588 |
|
Texas
|
|
588 |
<?=gettext("Texas");?>
|
589 |
589 |
</td>
|
590 |
590 |
</tr>
|
591 |
591 |
<tr>
|
592 |
|
<td align="right">City : </td>
|
|
592 |
<td align="right"><?=gettext("City");?> : </td>
|
593 |
593 |
<td align="left">
|
594 |
594 |
<input name="csr_dn_city" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['csr_dn_city']);?>" />
|
595 |
595 |
|
596 |
596 |
<em>ex:</em>
|
597 |
597 |
|
598 |
|
Austin
|
|
598 |
<?=gettext("Austin");?>
|
599 |
599 |
</td>
|
600 |
600 |
</tr>
|
601 |
601 |
<tr>
|
602 |
|
<td align="right">Organization : </td>
|
|
602 |
<td align="right"><?=gettext("Organization");?> : </td>
|
603 |
603 |
<td align="left">
|
604 |
604 |
<input name="csr_dn_organization" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['csr_dn_organization']);?>" />
|
605 |
605 |
|
606 |
606 |
<em>ex:</em>
|
607 |
607 |
|
608 |
|
My Company Inc.
|
|
608 |
<?=gettext("My Company Inc.");?>
|
609 |
609 |
</td>
|
610 |
610 |
</tr>
|
611 |
611 |
<tr>
|
612 |
|
<td align="right">Email Address : </td>
|
|
612 |
<td align="right"><?=gettext("Email Address");?> : </td>
|
613 |
613 |
<td align="left">
|
614 |
614 |
<input name="csr_dn_email" type="text" class="formfld unknown" size="25" value="<?=htmlspecialchars($pconfig['csr_dn_email']);?>"/>
|
615 |
615 |
|
616 |
616 |
<em>ex:</em>
|
617 |
617 |
|
618 |
|
webadmin@mycompany.com
|
|
618 |
<?=gettext("webadmin@mycompany.com");?>
|
619 |
619 |
</td>
|
620 |
620 |
</tr>
|
621 |
621 |
<tr>
|
622 |
|
<td align="right">Common Name : </td>
|
|
622 |
<td align="right"><?=gettext("Common Name");?> : </td>
|
623 |
623 |
<td align="left">
|
624 |
624 |
<input name="csr_dn_commonname" type="text" class="formfld unknown" size="25" value="<?=htmlspecialchars($pconfig['csr_dn_commonname']);?>"/>
|
625 |
625 |
|
626 |
626 |
<em>ex:</em>
|
627 |
627 |
|
628 |
|
www.example.com
|
|
628 |
<?=gettext("www.example.com");?>
|
629 |
629 |
</td>
|
630 |
630 |
</tr>
|
631 |
631 |
</table>
|
... | ... | |
660 |
660 |
<td colspan="2" class="list" height="12"></td>
|
661 |
661 |
</tr>
|
662 |
662 |
<tr>
|
663 |
|
<td colspan="2" valign="top" class="listtopic">Complete Signing Request</td>
|
|
663 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("Complete Signing Request");?></td>
|
664 |
664 |
</tr>
|
665 |
665 |
|
666 |
666 |
<tr>
|
667 |
|
<td width="22%" valign="top" class="vncellreq">Signing Request data</td>
|
|
667 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Signing Request data");?></td>
|
668 |
668 |
<td width="78%" class="vtable">
|
669 |
669 |
<textarea name="csr" id="csr" cols="65" rows="7" class="formfld_cert" readonly><?=$pconfig['csr'];?></textarea>
|
670 |
670 |
<br>
|
671 |
|
Copy the certificate signing data from here and forward it to your certificate authority for signing.</td>
|
|
671 |
<?=gettext("Copy the certificate signing data from here and forward it to your certificate authority for signing.");?></td>
|
672 |
672 |
</td>
|
673 |
673 |
</tr>
|
674 |
674 |
<tr>
|
675 |
|
<td width="22%" valign="top" class="vncellreq">Final Certificate data</td>
|
|
675 |
<td width="22%" valign="top" class="vncellreq"><?=gettext("Final Certificate data");?></td>
|
676 |
676 |
<td width="78%" class="vtable">
|
677 |
677 |
<textarea name="cert" id="cert" cols="65" rows="7" class="formfld_cert"><?=$pconfig['cert'];?></textarea>
|
678 |
678 |
<br>
|
679 |
|
Paste the certificate received from your cerificate authority here.</td>
|
|
679 |
<?=gettext("Paste the certificate received from your cerificate authority here.");?></td>
|
680 |
680 |
</td>
|
681 |
681 |
</tr>
|
682 |
682 |
<tr>
|
... | ... | |
696 |
696 |
|
697 |
697 |
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
698 |
698 |
<tr>
|
699 |
|
<td width="20%" class="listhdrr">Name</td>
|
700 |
|
<td width="20%" class="listhdrr">Issuer</td>
|
701 |
|
<td width="40%" class="listhdrr">Distinguished Name</td>
|
|
699 |
<td width="20%" class="listhdrr"><?=gettext("Name");?></td>
|
|
700 |
<td width="20%" class="listhdrr"><?=gettext("Issuer");?></td>
|
|
701 |
<td width="40%" class="listhdrr"><?=gettext("Distinguished Name");?></td>
|
702 |
702 |
<td width="10%" class="list"></td>
|
703 |
703 |
</tr>
|
704 |
704 |
<?php
|
... | ... | |
710 |
710 |
$subj = cert_get_subject($cert['crt']);
|
711 |
711 |
$issuer = cert_get_issuer($cert['crt']);
|
712 |
712 |
if($subj==$issuer)
|
713 |
|
$caname = "<em>self-signed</em>";
|
|
713 |
$caname = "<em>" . gettext("self-signed") . "</em>";
|
714 |
714 |
else
|
715 |
|
$caname = "<em>external</em>";
|
|
715 |
$caname = "<em>" . gettext("external"). "</em>";
|
716 |
716 |
$subj = htmlspecialchars($subj);
|
717 |
717 |
}
|
718 |
718 |
|
719 |
719 |
if ($cert['csr']) {
|
720 |
720 |
$subj = htmlspecialchars(csr_get_subject($cert['csr']));
|
721 |
|
$caname = "<em>external - signature pending</em>";
|
|
721 |
$caname = "<em>" . gettext("external - signature pending") . "</em>";
|
722 |
722 |
}
|
723 |
723 |
|
724 |
724 |
$ca = lookup_ca($cert['caref']);
|
... | ... | |
747 |
747 |
<td class="listr"><?=$subj;?> </td>
|
748 |
748 |
<td valign="middle" nowrap class="list">
|
749 |
749 |
<a href="system_certmanager.php?act=exp&id=<?=$i;?>")">
|
750 |
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="export cert" alt="export ca" width="17" height="17" border="0" />
|
|
750 |
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export cert");?>" alt="<?=gettext("export ca");?>" width="17" height="17" border="0" />
|
751 |
751 |
</a>
|
752 |
752 |
<a href="system_certmanager.php?act=key&id=<?=$i;?>")">
|
753 |
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="export key" alt="export ca" width="17" height="17" border="0" />
|
|
753 |
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export key");?>" alt="<?=gettext("export ca");?>" width="17" height="17" border="0" />
|
754 |
754 |
</a>
|
755 |
755 |
<a href="system_certmanager.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate?");?>')">
|
756 |
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="delete cert" alt="delete cert" width="17" height="17" border="0" />
|
|
756 |
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete cert");?>" alt="<?=gettext("delete cert");?>" width="17" height="17" border="0" />
|
757 |
757 |
</a>
|
758 |
758 |
<?php if ($cert['csr']): ?>
|
759 |
759 |
|
760 |
760 |
<a href="system_certmanager.php?act=csr&id=<?=$i;?>">
|
761 |
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="update csr" alt="update csr" width="17" height="17" border="0" />
|
|
761 |
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("update csr");?>" alt="<?=gettext("update csr");?>" width="17" height="17" border="0" />
|
762 |
762 |
</a>
|
763 |
763 |
<?php endif; ?>
|
764 |
764 |
</td>
|
... | ... | |
771 |
771 |
<td class="list" colspan="3"></td>
|
772 |
772 |
<td class="list">
|
773 |
773 |
<a href="system_certmanager.php?act=new">
|
774 |
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="add or import ca" alt="add ca" width="17" height="17" border="0" />
|
|
774 |
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add or import ca");?>" alt="<?=gettext("add ca");?>" width="17" height="17" border="0" />
|
775 |
775 |
</a>
|
776 |
776 |
</td>
|
777 |
777 |
</tr>
|
Gettext for System::Cert manager