add informational messageboxes

- for keys, requests, certificates, crls or templates
 - when successfully created or imported one.
This commit is contained in:
Christian Hohnstaedt 2010-02-23 19:17:44 +01:00
parent 03c9fbb6c0
commit 00eccfe98f
26 changed files with 210 additions and 54 deletions

View File

@ -10,10 +10,6 @@
</context>
<context>
<name>CaProperties</name>
<message>
<source>CA properties</source>
<translation type="obsolete">CA Einstellungen</translation>
</message>
<message>
<source>Next serial for signing</source>
<translation>Nächste Seriennummer beim signieren</translation>
@ -36,11 +32,11 @@
</message>
<message>
<source>CA Properties</source>
<translation type="unfinished"></translation>
<translation>CA Einstellungen</translation>
</message>
<message>
<source>Use random Serial numbers</source>
<translation type="unfinished"></translation>
<translation>Verwende zufällige Seriennummern</translation>
</message>
</context>
<context>
@ -556,6 +552,10 @@ PKCS#8 ist ein offizielles Austauschformat für Passwort gesicherte Schlüssel</
<source>The type of the item &apos;%1&apos; is not recognized</source>
<translation>Unbekannter Typ bei &apos;%1&apos;</translation>
</message>
<message>
<source>Successfully imported the %1 &apos;%2&apos;</source>
<translation>%1 erfolgreich importiert als &apos;%2&apos;</translation>
</message>
</context>
<context>
<name>KeyDetail</name>
@ -670,10 +670,6 @@ PKCS#8 ist ein offizielles Austauschformat für Passwort gesicherte Schlüssel</
<source>The following error occured:</source>
<translation>Der folgende Fehler ist aufgetreten:</translation>
</message>
<message>
<source>&amp;OK</source>
<translation type="obsolete">&amp;OK</translation>
</message>
<message>
<source>Copy to Clipboard</source>
<translation>In die Zwischenablage</translation>
@ -938,6 +934,10 @@ PKCS#8 ist ein offizielles Austauschformat für Passwort gesicherte Schlüssel</
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Using or exporting private keys will not be possible without providing the correct password</source>
<translation>Die Benutzung oder der Export privater Schlüssel ist nur mit dem richtigen Datenbankpasswort möglich</translation>
</message>
</context>
<context>
<name>NewCrl</name>
@ -1617,10 +1617,6 @@ though you have declared them as mandatory in the options menu.</source>
<source>Advanced Settings Error: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Organisational unit</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Options</name>
@ -1997,6 +1993,13 @@ Bitte die Zeiten manuell einstellen.</translation>
<translation>&amp;OK</translation>
</message>
</context>
<context>
<name>db_base</name>
<message>
<source>Successfully created the %1 &apos;%2&apos;</source>
<translation>%1 erfolgreich erstellt als &apos;%2&apos;</translation>
</message>
</context>
<context>
<name>db_crl</name>
<message>
@ -2013,7 +2016,7 @@ Bitte die Zeiten manuell einstellen.</translation>
</message>
<message>
<source>No. revoked</source>
<translation type="unfinished">Anzahl</translation>
<translation>Anzahl</translation>
</message>
<message>
<source>Next update</source>
@ -2533,6 +2536,10 @@ und wurde daher nicht importiert</translation>
<source>Unable to load the revokation list in file %1. Tried PEM and DER formatted CRL.</source>
<translation>Konnte die Sperrliste %1 nicht laden. Ist weder eine PEM noch eine DER formatierte CRL.</translation>
</message>
<message>
<source>certificate revokation list</source>
<translation>Zertifikatssperrliste</translation>
</message>
</context>
<context>
<name>pki_evp</name>
@ -2564,10 +2571,6 @@ und wurde daher nicht importiert</translation>
<source>No password</source>
<translation>Kein Passwort</translation>
</message>
<message>
<source>Please enter the database password for decrypting the key</source>
<translation>Bitte das Datenbankpasswort zur Entschlüsselung eingeben</translation>
</message>
<message>
<source>Please enter the password to protect the private key: &apos;%1&apos;</source>
<translation>Bitte geben sie das Passwort zur Verschlüsselung des privaten Schlüssels: &apos;%1&apos; ein</translation>
@ -2584,6 +2587,10 @@ und wurde daher nicht importiert</translation>
<source>Please enter the export password for the private key &apos;%1&apos;</source>
<translation>Bitte das Passwort zum Schutz des privaten Schlüssels &apos;%1&apos; eingeben</translation>
</message>
<message>
<source>Please enter the database password for decrypting the key &apos;%1&apos;</source>
<translation>Bitte das Datenbankpasswort zur Entschlüsselung des Schlüssels &apos;%1&apos; eingeben</translation>
</message>
</context>
<context>
<name>pki_key</name>
@ -2611,6 +2618,14 @@ und wurde daher nicht importiert</translation>
<source>PIN</source>
<translation>PIN</translation>
</message>
<message>
<source>%1 public key</source>
<translation>Öffentlicher %1 Schlüssel</translation>
</message>
<message>
<source>%1 private key</source>
<translation>Privater %1 Schlüssel</translation>
</message>
</context>
<context>
<name>pki_multi</name>
@ -2710,6 +2725,10 @@ und wurde daher nicht importiert</translation>
<source>Template file content error (bad length) :%1</source>
<translation>Templatefile ungültig (länge): %1</translation>
</message>
<message>
<source>XCA template</source>
<translation>XCA Vorlage</translation>
</message>
</context>
<context>
<name>pki_x509</name>
@ -2749,6 +2768,10 @@ und wurde daher nicht importiert</translation>
<source>Delete the certificate &apos;%1&apos; from the token &apos;%2 (#%3)&apos; ?</source>
<translation>Das Zertifikat &apos;%1&apos; von der Smartcard &apos;%2 (#%3)&apos; löschen ?</translation>
</message>
<message>
<source>certificate</source>
<translation>Zertifikat</translation>
</message>
</context>
<context>
<name>pki_x509req</name>
@ -2768,6 +2791,14 @@ und wurde daher nicht importiert</translation>
<source>Unhandled</source>
<translation>Unbehandelt</translation>
</message>
<message>
<source>SPKAC request</source>
<translation>SPKAC Zertifikatsanfrage</translation>
</message>
<message>
<source>PKCS#10 request</source>
<translation>PKCS#10 Zertifikatsanfrage</translation>
</message>
</context>
<context>
<name>v3ext</name>

View File

@ -552,6 +552,10 @@ PKCS#8 es un formato estandar de intercambio de claves</translation>
<source>The type of the item &apos;%1&apos; is not recognized</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Successfully imported the %1 &apos;%2&apos;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KeyDetail</name>
@ -930,6 +934,10 @@ PKCS#8 es un formato estandar de intercambio de claves</translation>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Using or exporting private keys will not be possible without providing the correct password</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NewCrl</name>
@ -1982,6 +1990,13 @@ You must set it manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>db_base</name>
<message>
<source>Successfully created the %1 &apos;%2&apos;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>db_crl</name>
<message>
@ -2507,6 +2522,10 @@ and thus was not stored</source>
<source>Unable to load the revokation list in file %1. Tried PEM and DER formatted CRL.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>certificate revokation list</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>pki_evp</name>
@ -2538,10 +2557,6 @@ and thus was not stored</source>
<source>No password</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please enter the database password for decrypting the key</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please enter the password to protect the private key: &apos;%1&apos;</source>
<translation type="unfinished"></translation>
@ -2558,6 +2573,10 @@ and thus was not stored</source>
<source>Please enter the export password for the private key &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please enter the database password for decrypting the key &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>pki_key</name>
@ -2585,6 +2604,14 @@ and thus was not stored</source>
<source>PIN</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 public key</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 private key</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>pki_multi</name>
@ -2684,6 +2711,10 @@ and thus was not stored</source>
<source>Template file content error (bad length) :%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>XCA template</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>pki_x509</name>
@ -2723,6 +2754,10 @@ and thus was not stored</source>
<source>Delete the certificate &apos;%1&apos; from the token &apos;%2 (#%3)&apos; ?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>certificate</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>pki_x509req</name>
@ -2742,6 +2777,14 @@ and thus was not stored</source>
<source>Unhandled</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SPKAC request</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PKCS#10 request</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>v3ext</name>

View File

@ -39,6 +39,17 @@ pki_base *db_base::newPKI(db_header_t *head){
return new pki_base("rootItem");
}
void db_base::createSuccess(pki_base *pki)
{
if (!pki)
return;
QMessageBox::information(mainwin, XCA_TITLE,
tr("Successfully created the %1 '%2'").
arg(pki->getFriendlyClassName()).
arg(pki->getIntName()));
}
void db_base::remFromCont(QModelIndex &idx)
{
if (!idx.isValid())

View File

@ -80,6 +80,7 @@ class db_base: public QAbstractItemModel
void storeSelectedItems(XcaTreeView *view);
void load_default(load_base &load);
void insertChild(pki_base *parent, pki_base *child);
void createSuccess(pki_base *pki);
public slots:
void deletePKI();

View File

@ -94,7 +94,7 @@ pki_base *db_crl::insert(pki_base *item)
QMessageBox::information(mainwin, XCA_TITLE,
tr("The revokation list already exists in the database as:\n'%1'\nand so it was not imported").arg(oldcrl->getIntName()));
delete(crl);
return oldcrl;
return NULL;
}
insertPKI(crl);
return crl;
@ -211,7 +211,7 @@ pki_crl *db_crl::newItem(pki_x509 *cert)
crl->sign(cert->getRefKey(), ui.hashAlgo->currentHash());
mainwin->certs->updatePKI(cert);
insert(crl);
createSuccess(insert(crl));
}
catch (errorEx &err) {
MainWindow::Error(err);

View File

@ -96,7 +96,7 @@ pki_base* db_key::insert(pki_base *item)
QMessageBox::information(mainwin, XCA_TITLE,
tr("The key is already in the database as:\n'%1'\nand is not going to be imported").arg(oldkey->getIntName()));
delete(lkey);
return oldkey;
return NULL;
}
else {
QMessageBox::information(mainwin, XCA_TITLE,
@ -162,6 +162,8 @@ void db_key::newItem(QString name)
}
key = (pki_key*)insert(key);
emit keyDone(key->getIntNameWithType());
createSuccess(key);
} catch (errorEx &err) {
delete key;
mainwin->Error(err);

View File

@ -136,6 +136,7 @@ void db_temp::newItem()
temp->setIntName("--");
if (runTempDlg(temp)) {
insertPKI(temp);
createSuccess(temp);
return;
}
}

View File

@ -315,7 +315,7 @@ pki_base *db_x509::insert(pki_base *item)
QMessageBox::information(mainwin, XCA_TITLE,
tr("The certificate already exists in the database as:\n'%1'\nand so it was not imported").arg(oldcert->getIntName()));
delete(cert);
return oldcert;
return NULL;
}
cert->setCaSerial((cert->getSerial()));
insertPKI(cert);
@ -542,7 +542,7 @@ void db_x509::newCert(NewX509 *dlg)
#endif
// and finally sign the request
cert->sign(signkey, hashAlgo);
insert(cert);
createSuccess(insert(cert));
updatePKI(signcert);
if (tempkey != NULL)
delete(tempkey);
@ -1048,7 +1048,7 @@ void db_x509::toRequest()
req->setIntName(cert->getIntName());
req->createReq(cert->getRefKey(), cert->getSubject(),
cert->getRefKey()->getDefaultMD(), cert->getV3ext());
mainwin->reqs->insert(req);
createSuccess(mainwin->reqs->insert(req));
}
catch (errorEx &err) {
mainwin->Error(err);

View File

@ -41,7 +41,7 @@ pki_base *db_x509req::insert(pki_base *item)
QMessageBox::information(mainwin, XCA_TITLE,
tr("The certificate signing request already exists in the database as\n'%1'\nand thus was not stored").arg(oldreq->getIntName()));
delete(req);
return oldreq;
return NULL;
}
insertPKI(req);
return req;
@ -71,7 +71,7 @@ void db_x509req::newItem(pki_temp *temp)
dlg->initCtx(NULL, NULL, req);
dlg->addReqAttributes(req);
req->createReq(key, xn, dlg->hashAlgo->currentHash(), dlg->getAllExt());
insert(req);
createSuccess(insert(req));
}
catch (errorEx &err) {
MainWindow::Error(err);

View File

@ -86,7 +86,7 @@ void db_x509super::toTemplate()
d->exec();
delete d;
}
mainwin->temps->insert(temp);
createSuccess(mainwin->temps->insert(temp));
}
catch (errorEx &err) {
mainwin->Error(err);

View File

@ -37,19 +37,28 @@ class pki_base : public QObject
QList<pki_base*> childItems;
pki_base(const QString d = "", pki_base *p = NULL);
virtual void fload(const QString) {};
virtual void writeDefault(const QString){};
virtual void writeDefault(const QString) {};
static int get_pki_counter(void);
virtual void fromData(const unsigned char *, db_header_t *){};
virtual void fromData(const unsigned char *, db_header_t *) {};
virtual void oldFromData(unsigned char *p, int size);
virtual unsigned char *toData(int *) { return NULL; }
virtual bool compare(pki_base *) { return false; };
virtual unsigned char *toData(int *)
{
return NULL;
}
virtual bool compare(pki_base *)
{
return false;
};
virtual ~pki_base();
QString getIntName() const;
QString getUnderlinedName() const;
void setIntName(const QString &d);
QString getClassName();
static QString rmslashdot(const QString &fname);
virtual QString getFriendlyClassName()
{
return QString("---");
};
int getVersion();
enum pki_type getType();
void setParent(pki_base *p);
@ -65,7 +74,10 @@ class pki_base : public QObject
int columns();
virtual QVariant column_data(int col);
virtual QVariant getIcon(int column);
const char *className() { return class_name; };
const char *className()
{
return class_name;
};
uint32_t intFromData(const unsigned char **p);
virtual void fromPEM_BIO(BIO *, QString) {};
virtual void deleteFromToken() { };

View File

@ -35,6 +35,11 @@ void pki_crl::fromPEM_BIO(BIO *bio, QString name)
setIntName(rmslashdot(name));
}
QString pki_crl::getFriendlyClassName()
{
return tr("certificate revokation list");
}
void pki_crl::fload(const QString fname )
{
FILE *fp = fopen(QString2filename(fname), "r");

View File

@ -57,6 +57,7 @@ class pki_crl: public pki_base
a1int getVersion();
QVariant column_data(int col);
QVariant getIcon(int column);
virtual QString getFriendlyClassName();
};
#endif

View File

@ -390,7 +390,7 @@ EVP_PKEY *pki_evp::decryptKey() const
int ret;
//printf("Passhash= '%s', new hash= '%s', passwd= '%s'\n",
//CCHAR(passHash), CCHAR(md5passwd(ownPassBuf)), ownPassBuf);
pass_info p(XCA_TITLE, tr("Please enter the database password for decrypting the key"));
pass_info p(XCA_TITLE, tr("Please enter the database password for decrypting the key '%1'").arg(getIntName()));
ret = MainWindow::passRead(ownPassBuf, MAX_PASS_LENGTH, 0, &p);
if (ret < 0)
throw errorEx(tr("Password input aborted"), class_name);

View File

@ -63,6 +63,12 @@ QString pki_key::getTypeString()
return type;
}
QString pki_key::getFriendlyClassName()
{
QString txt = isPubKey() ? tr("%1 public key") : tr("%1 private key");
return txt.arg(getTypeString());
}
QString pki_key::getIntNameWithType()
{
return getIntName() + " (" + getTypeString() + ")";

View File

@ -44,6 +44,8 @@ class pki_key: public pki_base
virtual QString getIntNameWithType(void);
virtual QList<int> possibleHashNids()
{ return QList<int>(); };
virtual QString getFriendlyClassName();
void writePublic(const QString fname, bool pem);
bool compare(pki_base *ref);

View File

@ -90,6 +90,11 @@ pki_temp::pki_temp(const QString d)
noWellDefined=false;
}
QString pki_temp::getFriendlyClassName()
{
return tr("XCA template");
}
static QStringList extVlistToString(extList &el, int nid, bool *crit)
{
int i = el.idxByNid(nid);

View File

@ -46,6 +46,8 @@ class pki_temp: public pki_base
void writeTemp(QString fname);
QVariant column_data(int col);
QVariant getIcon(int column);
virtual QString getFriendlyClassName();
};
#endif

View File

@ -56,6 +56,11 @@ pki_x509::pki_x509(const QString name)
openssl_error();
}
QString pki_x509::getFriendlyClassName()
{
return tr("certificate");
}
void pki_x509::fromPEM_BIO(BIO *bio, QString name)
{
X509 *_cert;

View File

@ -137,6 +137,7 @@ class pki_x509 : public pki_x509super
QVariant getIcon(int column);
QByteArray i2d();
void deleteFromToken();
virtual QString getFriendlyClassName();
};
#endif

View File

@ -75,6 +75,10 @@ void pki_x509req::createReq(pki_key *key, const x509name &dn, const EVP_MD *md,
EVP_PKEY_free(privkey);
}
QString pki_x509req::getFriendlyClassName()
{
return isSpki() ? tr("SPKAC request") : tr("PKCS#10 request");
}
void pki_x509req::fromPEM_BIO(BIO *bio, QString name)
{

View File

@ -46,7 +46,10 @@ class pki_x509req : public pki_x509super
x509name getSubject() const;
bool isSpki() const;
void writeReq(const QString fname, bool pem);
X509_REQ *getReq() {return request;}
X509_REQ *getReq()
{
return request;
}
void addAttribute(int nid, QString content);
int verify();
@ -59,8 +62,16 @@ class pki_x509req : public pki_x509super
ASN1_IA5STRING *spki_challange();
QVariant column_data(int col);
QVariant getIcon(int column);
void setDone() { done = true; }
bool getDone() { return done; }
void setDone()
{
done = true;
}
bool getDone()
{
return done;
}
virtual QString getFriendlyClassName();
};
#endif

View File

@ -83,7 +83,7 @@
<item>
<widget class="QTabWidget" name="tabview">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="unnamed">
<attribute name="title">

View File

@ -119,13 +119,13 @@ void ImportMulti::on_butImport_clicked()
}
}
void ImportMulti::import(QModelIndex &idx)
pki_base *ImportMulti::import(QModelIndex &idx)
{
pki_base *pki = static_cast<pki_base*>(idx.internalPointer());
if (!pki)
return;
return NULL;
if (!mainwin->keys) {
mainwin->load_database();
}
@ -134,28 +134,30 @@ void ImportMulti::import(QModelIndex &idx)
mcont->remFromCont(idx);
if (!mainwin->keys) {
delete pki;
return;
return NULL;
}
if (cn == "pki_x509") {
MainWindow::certs->insert(pki);
pki = MainWindow::certs->insert(pki);
} else if (cn == "pki_evp") {
((pki_evp*)pki)->setOwnPass(pki_evp::ptCommon);
MainWindow::keys->insert(pki);
pki = MainWindow::keys->insert(pki);
} else if (cn == "pki_scard") {
MainWindow::keys->insert(pki);
pki = MainWindow::keys->insert(pki);
} else if (cn == "pki_x509req") {
MainWindow::reqs->insert(pki);
pki = MainWindow::reqs->insert(pki);
} else if (cn == "pki_crl") {
MainWindow::crls->insert(pki);
pki = MainWindow::crls->insert(pki);
} else if (cn == "pki_temp") {
MainWindow::temps->insert(pki);
pki = MainWindow::temps->insert(pki);
} else {
QMessageBox::warning(this, XCA_TITLE,
tr("The type of the Item '%1' is not recognized").
arg(cn));
delete pki;
return NULL;
}
return pki;
}
void ImportMulti::on_butDetails_clicked()
@ -239,7 +241,14 @@ void ImportMulti::execute(int force)
return;
/* if there is only 1 item and force is 0 import it silently */
if (entries() == 1 && force == 0) {
on_butOk_clicked();
QModelIndex idx = mcont->index(0, 0, QModelIndex());
pki_base *pki = import(idx);
if (pki)
QMessageBox::information(this, XCA_TITLE,
tr("Successfully imported the %1 '%2'").
arg(pki->getFriendlyClassName()).
arg(pki->getIntName()));
accept();
return;
}
/* the behavoiour for more than one item */

View File

@ -27,7 +27,7 @@ class ImportMulti: public QDialog, private Ui::ImportMulti
~ImportMulti();
void addItem(pki_base *pki);
pki_base *getSelected();
void import(QModelIndex &idx);
pki_base *import(QModelIndex &idx);
void execute(int force=0);
int entries();

View File

@ -121,6 +121,10 @@ void MainWindow::init_database()
}
setWindowTitle(tr(XCA_TITLE));
setItemEnabled(true);
if (pki_evp::passwd[0] == '\0')
QMessageBox::information(this, XCA_TITLE,
tr("Using or exporting private keys will not be possible without providing the correct password"));
dbindex->setText(tr("Database") + ":" + dbfile);
load_engine();
}