mirror of
https://github.com/chris2511/xca.git
synced 2026-09-14 11:06:19 +05:00
Make hex the default input / output qstring of asn1integer
This commit is contained in:
parent
d22cfb0b53
commit
4eeb856c73
@ -42,6 +42,12 @@ a1int::a1int(const a1int &a)
|
||||
in = dup(a.in);
|
||||
}
|
||||
|
||||
a1int::a1int(const QString &hex)
|
||||
{
|
||||
in = ASN1_INTEGER_new();
|
||||
check_oom(in);
|
||||
setHex(hex);
|
||||
}
|
||||
|
||||
a1int::a1int(long l)
|
||||
{
|
||||
@ -202,6 +208,11 @@ bool a1int::operator != (const a1int &a) const
|
||||
return (ASN1_INTEGER_cmp(in, a.in) != 0);
|
||||
}
|
||||
|
||||
a1int::operator QString() const
|
||||
{
|
||||
return toHex();
|
||||
}
|
||||
|
||||
QByteArray a1int::i2d()
|
||||
{
|
||||
return i2d_bytearray(I2D_VOID(i2d_ASN1_INTEGER), in);
|
||||
|
||||
@ -23,6 +23,7 @@ class a1int
|
||||
a1int(const ASN1_INTEGER *i);
|
||||
a1int(const a1int &a);
|
||||
a1int(long l);
|
||||
a1int(const QString &hex);
|
||||
~a1int();
|
||||
a1int &set(const ASN1_INTEGER *i);
|
||||
a1int &set(long l);
|
||||
@ -45,6 +46,7 @@ class a1int
|
||||
bool operator < (const a1int &a) const;
|
||||
bool operator == (const a1int &a) const;
|
||||
bool operator != (const a1int &a) const;
|
||||
operator QString() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -698,7 +698,7 @@ QString pki_x509::getIndexEntry()
|
||||
return QString("%1\t%2\t%3\t%4\tunknown\t%5\n").arg(
|
||||
flag, getNotAfter().toPlainUTC(),
|
||||
revoked ? revocation.getDate().toPlainUTC() : "",
|
||||
getSerial().toHex(),
|
||||
getSerial(),
|
||||
QString(X509_NAME_oneline(getSubject().get(), NULL, 0)));
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ void CertDetail::setCert(pki_x509 *cert)
|
||||
}
|
||||
|
||||
// the serial
|
||||
serialNr->setText(cert->getSerial().toHex());
|
||||
serialNr->setText(cert->getSerial());
|
||||
|
||||
// details of the issuer
|
||||
issuer->setX509name(cert->getIssuerName());
|
||||
|
||||
@ -64,7 +64,7 @@ void CrlDetail::setCrl(pki_crl *crl)
|
||||
lUpdate->setToolTip(crl->getLastUpdate().toPrettyGMT());
|
||||
nUpdate->setText(crl->getNextUpdate().toPretty());
|
||||
nUpdate->setToolTip(crl->getNextUpdate().toPrettyGMT());
|
||||
version->setText((++crl->getVersion()).toHex());
|
||||
version->setText((++crl->getVersion()));
|
||||
|
||||
issuer->setX509name(crl->getSubject());
|
||||
|
||||
|
||||
@ -21,10 +21,8 @@ class revListItem : public QTreeWidgetItem
|
||||
int col = treeWidget()->sortColumn();
|
||||
switch (col) {
|
||||
case Cserial: {
|
||||
a1int ithis, iother;
|
||||
ithis.setHex(text(Cserial));
|
||||
iother.setHex(other.text(Cserial));
|
||||
return ithis < iother;
|
||||
return a1int(text(Cserial)) <
|
||||
a1int(other.text(Cserial));
|
||||
}
|
||||
case Cnumber:
|
||||
return text(Cnumber).toLong() <
|
||||
@ -43,7 +41,7 @@ static void setup_revRevItem(QTreeWidgetItem *item, const x509rev &revit,
|
||||
for (int i = 0; i < Cmax; i++)
|
||||
item->setToolTip(i, rev->getIntName());
|
||||
}
|
||||
item->setText(Cserial, revit.getSerial().toHex());
|
||||
item->setText(Cserial, revit.getSerial());
|
||||
item->setText(Cdate, revit.getDate().toSortable());
|
||||
item->setText(Creason, revit.getReason());
|
||||
|
||||
@ -141,14 +139,12 @@ void RevocationList::on_delRev_clicked(void)
|
||||
QTreeWidgetItem *current = certList->currentItem();
|
||||
x509rev rev;
|
||||
int idx;
|
||||
a1int a1_serial;
|
||||
|
||||
if (!current)
|
||||
return;
|
||||
idx = certList->indexOfTopLevelItem(current);
|
||||
certList->takeTopLevelItem(idx);
|
||||
a1_serial.setHex(current->text(Cserial));
|
||||
rev.setSerial(a1_serial);
|
||||
rev.setSerial(a1int(current->text(Cserial)));
|
||||
idx = revList.indexOf(rev);
|
||||
if (idx != -1)
|
||||
revList.takeAt(idx);
|
||||
@ -159,13 +155,11 @@ void RevocationList::on_editRev_clicked()
|
||||
QTreeWidgetItem *current = certList->currentItem();
|
||||
x509rev rev;
|
||||
int idx;
|
||||
a1int a1_serial;
|
||||
|
||||
if (!current)
|
||||
return;
|
||||
|
||||
a1_serial.setHex(current->text(Cserial));
|
||||
rev.setSerial(a1_serial);
|
||||
rev.setSerial(a1int(current->text(Cserial)));
|
||||
idx = revList.indexOf(rev);
|
||||
if (idx == -1)
|
||||
return;
|
||||
@ -203,13 +197,13 @@ Revocation::Revocation(QWidget *w, QModelIndexList indexes) : QDialog(w)
|
||||
}
|
||||
qSort(serials.begin(), serials.end());
|
||||
foreach(a1int a, serials)
|
||||
sl << a.toHex();
|
||||
sl << a;
|
||||
serial->setToolTip(sl.join("\n"));
|
||||
serial->setEnabled(false);
|
||||
} else if (indexes.size() == 1) {
|
||||
pki_x509 *cert = static_cast<pki_x509*>
|
||||
(indexes[0].internalPointer());
|
||||
serial->setText(cert->getSerial().toHex());
|
||||
serial->setText(cert->getSerial());
|
||||
serial->setEnabled(false);
|
||||
} else {
|
||||
serial->setValidator(
|
||||
@ -221,7 +215,7 @@ x509rev Revocation::getRevocation()
|
||||
{
|
||||
x509rev r;
|
||||
|
||||
r.setSerial(a1int().setHex(serial->text()));
|
||||
r.setSerial(a1int(serial->text()));
|
||||
r.setInvalDate(invalid->getDate());
|
||||
r.setDate(a1time());
|
||||
r.setCrlNo(0);
|
||||
@ -233,7 +227,7 @@ void Revocation::setRevocation(x509rev r)
|
||||
{
|
||||
a1int i;
|
||||
|
||||
serial->setText(r.getSerial().toHex());
|
||||
serial->setText(r.getSerial());
|
||||
invalid->setDate(r.getInvalDate());
|
||||
reason->setCurrentText(r.getReason());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user