function csr_get_modulus($str_crt, $decode = true) { return cert_get_modulus($str_crt, $decode, 'csr'); }
if (preg_match("/[\\?\\>\\<\\&\\/\\\"\\']/", $_POST['descr'])) { array_push($input_errors, "The field 'Descriptive Name' contains invalid characters."); } // old way /* make sure this csr and certificate subjects match */ // $subj_csr = csr_get_subject($pconfig['csr'], false); // $subj_cert = cert_get_subject($pconfig['cert'], false); // // if (!isset($_POST['ignoresubjectmismatch']) && !($_POST['ignoresubjectmismatch'] == "yes")) { // if (strcmp($subj_csr, $subj_cert)) { // $input_errors[] = sprintf(gettext("The certificate subject '%s' does not match the signing request subject."), $subj_cert); // $subject_mismatch = true; // } // } $mod_csr = csr_get_modulus($pconfig['csr'], false); $mod_cert = cert_get_modulus($pconfig['cert'], false); if (strcmp($mod_csr, $mod_cert)) { // simply: if the moduli don't match, then the private key and public key won't match $input_errors[] = sprintf(gettext("The certificate modulus does not match the signing request modulus."), $subj_cert); $subject_mismatch = true; } /* if this is an AJAX caller then handle via JSON */ if (isAjax() && is_array($input_errors)) { input_errors2Ajax($input_errors); exit; } /* save modifications */ if (!$input_errors) { $cert = $a_cert[$id]; $cert['descr'] = $pconfig['descr']; csr_complete($cert, $pconfig['cert']);