103 |
103 |
$pconfig['digest_alg'] = "sha256";
|
104 |
104 |
$pconfig['csr_keylen'] = "2048";
|
105 |
105 |
$pconfig['csr_digest_alg'] = "sha256";
|
|
106 |
$pconfig['csrsign_digest_alg'] = "sha256";
|
106 |
107 |
$pconfig['type'] = "user";
|
107 |
108 |
$pconfig['lifetime'] = "3650";
|
108 |
109 |
}
|
... | ... | |
371 |
372 |
if (($pconfig['method'] == "external") && !in_array($_POST["csr_digest_alg"], $openssl_digest_algs)) {
|
372 |
373 |
array_push($input_errors, gettext("Please select a valid Digest Algorithm."));
|
373 |
374 |
}
|
|
375 |
if (($pconfig['method'] == "sign") && !in_array($_POST["csrsign_digest_alg"], $openssl_digest_algs)) {
|
|
376 |
array_push($input_errors, gettext("Please select a valid Digest Algorithm."));
|
|
377 |
}
|
374 |
378 |
}
|
375 |
379 |
|
376 |
380 |
/* save modifications */
|
... | ... | |
398 |
402 |
$altname_str = implode(",", $altnames_tmp);
|
399 |
403 |
}
|
400 |
404 |
|
401 |
|
$n509 = csr_sign($csr, $ca, $pconfig['csrsign_lifetime'], $pconfig['type'], $altname_str);
|
|
405 |
$n509 = csr_sign($csr, $ca, $pconfig['csrsign_lifetime'], $pconfig['type'], $altname_str, $pconfig['csrsign_digest_alg']);
|
402 |
406 |
|
403 |
407 |
if ($n509) {
|
404 |
408 |
// Gather the details required to save the new cert
|
... | ... | |
718 |
722 |
'csrsign_lifetime',
|
719 |
723 |
'*Certificate Lifetime (days)',
|
720 |
724 |
'number',
|
721 |
|
$pconfig['duration'] ? $pconfig['duration']:'3650'
|
|
725 |
$pconfig['csrsign_lifetime'] ? $pconfig['csrsign_lifetime']:'3650'
|
722 |
726 |
));
|
|
727 |
$section->addInput(new Form_Select(
|
|
728 |
'csrsign_digest_alg',
|
|
729 |
'*Digest Algorithm',
|
|
730 |
$pconfig['csrsign_digest_alg'],
|
|
731 |
array_combine($openssl_digest_algs, $openssl_digest_algs)
|
|
732 |
))->setHelp('NOTE: It is recommended to use an algorithm stronger than '.
|
|
733 |
'SHA1 when possible');
|
723 |
734 |
|
724 |
735 |
$form->add($section);
|
725 |
736 |
|
... | ... | |
1173 |
1184 |
<?=$subj?>
|
1174 |
1185 |
<?php
|
1175 |
1186 |
$certextinfo = "";
|
|
1187 |
$certserial = cert_get_serial($cert['crt']);
|
|
1188 |
if (!empty($certserial)) {
|
|
1189 |
$certextinfo .= '<b>' . gettext("Serial: ") . '</b> ';
|
|
1190 |
$certextinfo .= htmlspecialchars(cert_escape_x509_chars($certserial, true));
|
|
1191 |
$certextinfo .= '<br/>';
|
|
1192 |
}
|
|
1193 |
$certsig = cert_get_sigtype($cert['crt']);
|
|
1194 |
if (is_array($certsig) && !empty($certsig) && !empty($certsig['shortname'])) {
|
|
1195 |
$certextinfo .= '<b>' . gettext("Signature Digest: ") . '</b> ';
|
|
1196 |
$certextinfo .= htmlspecialchars(cert_escape_x509_chars($certsig['shortname'], true));
|
|
1197 |
$certextinfo .= '<br/>';
|
|
1198 |
}
|
1176 |
1199 |
if (is_array($sans) && !empty($sans)) {
|
1177 |
1200 |
$certextinfo .= '<b>' . gettext("SAN: ") . '</b> ';
|
1178 |
1201 |
$certextinfo .= htmlspecialchars(implode(', ', cert_escape_x509_chars($sans, true)));
|
Add a field to pick a digest algo when signing a CSR, otherwise it ends up with SHA1. Fixes #7853
While here, add the cert serial number and sig digest type to the info block for each cert.
(cherry picked from commit aec3a259271be5dae63b148a48b7778c0cd0660e)