Replace certificate while renewing it

This commit also changes the default state of
the "Revoke old certificate" checkbox to unchecked.
The reasoning for this is that by renewing a certificate
its lifetime and subsequently validity are prolonged,
which therefore implies equal trustworthiness
for both new and old certificates, which does not intend
the revocation of the latter.
This commit is contained in:
pf 2021-05-31 23:52:06 +03:00
parent 2635b91033
commit 8af3cabfa8
2 changed files with 16 additions and 0 deletions

View File

@ -837,6 +837,7 @@ void db_x509::certRenewal(QModelIndexList indexes)
CertExtend *dlg = NULL;
x509rev r;
bool doRevoke = false;
bool doReplace = false;
if (indexes.size() == 0)
return;
@ -862,6 +863,7 @@ void db_x509::certRenewal(QModelIndexList indexes)
r = revoke->getRevocation();
delete revoke;
}
doReplace = dlg->replace->isChecked();
foreach(idx, indexes) {
oldcert = fromIndex<pki_x509>(idx);
if (!oldcert)
@ -887,6 +889,10 @@ void db_x509::certRenewal(QModelIndexList indexes)
newcert->sign(signkey, oldcert->getDigest());
newcert = dynamic_cast<pki_x509 *>(insert(newcert));
createSuccess(newcert);
// delete old certificate if requested
if (doReplace)
deletePKI(idx);
}
if (doRevoke)
do_revoke(indexes, r);

View File

@ -215,6 +215,16 @@
<property name="text">
<string>Revoke old certificate</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="replace">
<property name="text">
<string>Replace old certificate</string>
</property>
<property name="checked">
<bool>true</bool>
</property>