mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Add OID resolver, move some Menu items to "Extra"
The OID resolver accepts any input OID, Nid, LongName, ShortName and looks it up in the OpenSSL OID database.
This commit is contained in:
parent
009b0470ce
commit
26d19c488f
@ -1,3 +1,4 @@
|
||||
* Add OID resolver, move some Menu items to "Extra"
|
||||
* SF. Bug. #81 Make xca qt5 compatible
|
||||
* SF. Bug. #107 error:0D0680A8:asn1 encoding
|
||||
* Don't validate notBefore and notAfter if they are disabled.
|
||||
|
||||
@ -9,7 +9,7 @@ UI_H = ui_About.h ui_CaProperties.h ui_CertDetail.h ui_CertExtend.h \
|
||||
ui_ImportMulti.h ui_KeyDetail.h ui_MainWindow.h ui_NewCrl.h \
|
||||
ui_NewKey.h ui_NewX509.h ui_Options.h ui_PwDialog.h ui_Revoke.h \
|
||||
ui_SelectToken.h ui_TrustState.h ui_v3ext.h ui_SearchPkcs11.h \
|
||||
ui_RevocationList.h
|
||||
ui_RevocationList.h ui_OidResolver.h
|
||||
|
||||
include $(TOPDIR)/Rules.mak
|
||||
|
||||
|
||||
229
ui/OidResolver.ui
Normal file
229
ui/OidResolver.ui
Normal file
@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OidResolver</class>
|
||||
<widget class="QDialog" name="OidResolver">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>266</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="headerLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>50</weight>
|
||||
<italic>false</italic>
|
||||
<bold>false</bold>
|
||||
<underline>false</underline>
|
||||
<strikeout>false</strikeout>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OID Resolver</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Enter The OID, the Nid, or one of the textual representations</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="input"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>OID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="CopyLabel" name="oid">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Short name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="CopyLabel" name="sn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Long name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="CopyLabel" name="ln">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="toolTip">
|
||||
<string>OpenSSL internal ID</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Nid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="CopyLabel" name="nid">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>OpenSSL internal ID</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CopyLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header location="global">widgets/clicklabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>OidResolver</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>227</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>OidResolver</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>295</x>
|
||||
<y>167</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>input</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>OidResolver</receiver>
|
||||
<slot>searchOid(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>131</x>
|
||||
<y>65</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>398</x>
|
||||
<y>12</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>searchOid(QString)</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
@ -17,7 +17,8 @@
|
||||
#include "lib/func.h"
|
||||
#include "lib/db_x509super.h"
|
||||
#include "ui_Options.h"
|
||||
#include "widgets/hashBox.h"
|
||||
#include "hashBox.h"
|
||||
#include "OidResolver.h"
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QMenuBar>
|
||||
@ -36,7 +37,7 @@ public:
|
||||
void MainWindow::init_menu()
|
||||
{
|
||||
static QMenu *file = NULL, *help = NULL, *import = NULL,
|
||||
*token = NULL, *languageMenu = NULL;
|
||||
*token = NULL, *languageMenu = NULL, *extra = NULL;
|
||||
static QActionGroup * langGroup = NULL;
|
||||
QAction *a;
|
||||
|
||||
@ -90,21 +91,11 @@ void MainWindow::init_menu()
|
||||
file->addAction(tr("&Open DataBase"), this, SLOT(load_database()),
|
||||
QKeySequence::Open);
|
||||
file->addMenu(historyMenu);
|
||||
file->addAction(tr("Generate DH parameter"), this,
|
||||
SLOT(generateDHparam()));
|
||||
file->addAction(tr("Set as default DataBase"), this,
|
||||
SLOT(default_database()));
|
||||
acList += file->addAction(tr("&Close DataBase"), this,
|
||||
SLOT(close_database()), QKeySequence(QKeySequence::Close));
|
||||
acList += file->addAction(tr("&Dump DataBase"), this,
|
||||
SLOT(dump_database()));
|
||||
acList += file->addAction(tr("C&hange DataBase password"), this,
|
||||
SLOT(changeDbPass()));
|
||||
acList += file->addAction(tr("&Import old db_dump"), this,
|
||||
SLOT(import_dbdump()));
|
||||
acList += file->addAction(tr("&Undelete items"), this,
|
||||
SLOT(undelete()));
|
||||
file->addSeparator();
|
||||
|
||||
a = new QAction(tr("Options"), this);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(setOptions()));
|
||||
a->setMenuRole(QAction::PreferencesRole);
|
||||
@ -141,6 +132,19 @@ void MainWindow::init_menu()
|
||||
token->addAction(tr("Init PIN"), this,
|
||||
SLOT(initPin()) );
|
||||
|
||||
extra = menuBar()->addMenu(tr("Extra"));
|
||||
acList += extra->addAction(tr("&Dump DataBase"), this,
|
||||
SLOT(dump_database()));
|
||||
acList += extra->addAction(tr("C&hange DataBase password"), this,
|
||||
SLOT(changeDbPass()));
|
||||
acList += extra->addAction(tr("&Import old db_dump"), this,
|
||||
SLOT(import_dbdump()));
|
||||
acList += extra->addAction(tr("&Undelete items"), this,
|
||||
SLOT(undelete()));
|
||||
extra->addAction(tr("Generate DH parameter"), this,
|
||||
SLOT(generateDHparam()));
|
||||
extra->addAction(tr("OID Resolver"), this, SLOT(resolveOID()));
|
||||
|
||||
help = menuBar()->addMenu(tr("&Help") );
|
||||
help->addAction(tr("&Content"), this, SLOT(help()),
|
||||
QKeySequence::HelpContents);
|
||||
@ -398,3 +402,10 @@ QString MainWindow::getOptFlags()
|
||||
flags << "disable_netscape";
|
||||
return flags.join(",");
|
||||
}
|
||||
|
||||
void MainWindow::resolveOID()
|
||||
{
|
||||
OidResolver *o = new OidResolver(this);
|
||||
o->exec();
|
||||
delete o;
|
||||
}
|
||||
|
||||
@ -169,5 +169,6 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
void initPin();
|
||||
void generateDHparam();
|
||||
void open_database(QAction* a);
|
||||
void resolveOID();
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -8,7 +8,8 @@ MOC_NAMES=MainWindow KeyDetail clicklabel XcaTreeView NewX509 \
|
||||
validity v3ext distname CertDetail CertExtend PwDialog \
|
||||
ImportMulti CrlDetail ExportDialog hashBox Options NewKey kvView \
|
||||
NewCrl SearchPkcs11 RevocationList XcaProxyModel XcaHeaderView \
|
||||
KeyTreeView TempTreeView ReqTreeView X509SuperTreeView CertTreeView
|
||||
KeyTreeView TempTreeView ReqTreeView X509SuperTreeView CertTreeView \
|
||||
OidResolver
|
||||
|
||||
NAMES=$(MOC_NAMES) NewX509_ext MW_menu MW_help MW_database
|
||||
OBJS=$(patsubst %,moc_%.o,$(MOC_NAMES)) $(patsubst %,%.o,$(NAMES))
|
||||
|
||||
52
widgets/OidResolver.cpp
Normal file
52
widgets/OidResolver.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
/* vi: set sw=4 ts=4:
|
||||
*
|
||||
* Copyright (C) 2001 - 2012 Christian Hohnstaedt.
|
||||
*
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include <openssl/objects.h>
|
||||
#include "OidResolver.h"
|
||||
#include "lib/base.h"
|
||||
#include "lib/func.h"
|
||||
#include "lib/exception.h"
|
||||
|
||||
OidResolver::OidResolver(QWidget *parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr(XCA_TITLE));
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
void OidResolver::searchOid(QString s)
|
||||
{
|
||||
bool ok;
|
||||
int n;
|
||||
|
||||
s = s.trimmed();
|
||||
n = s.toUInt(&ok);
|
||||
if (!ok)
|
||||
n = OBJ_txt2nid(CCHAR(s));
|
||||
ign_openssl_error();
|
||||
if (n == NID_undef) {
|
||||
ln->clear();
|
||||
sn->clear();
|
||||
oid->clear();
|
||||
nid->clear();
|
||||
} else {
|
||||
const ASN1_OBJECT *a = OBJ_nid2obj(n);
|
||||
ln->setText(OBJ_nid2ln(n));
|
||||
sn->setText(OBJ_nid2sn(n));
|
||||
nid->setText(QString("%1").arg(n));
|
||||
if (a) {
|
||||
try {
|
||||
oid->setText(OBJ_obj2QString(a, 1));
|
||||
} catch (errorEx &e) {
|
||||
oid->clear();
|
||||
}
|
||||
} else {
|
||||
oid->clear();
|
||||
}
|
||||
}
|
||||
ign_openssl_error();
|
||||
}
|
||||
24
widgets/OidResolver.h
Normal file
24
widgets/OidResolver.h
Normal file
@ -0,0 +1,24 @@
|
||||
/* vi: set sw=4 ts=4:
|
||||
*
|
||||
* Copyright (C) 2015 Christian Hohnstaedt.
|
||||
*
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __OID_RESOLVER_H
|
||||
#define __OID_RESOLVER_H
|
||||
|
||||
#include "ui_OidResolver.h"
|
||||
|
||||
class OidResolver: public QDialog, public Ui::OidResolver
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OidResolver(QWidget *w);
|
||||
|
||||
public slots:
|
||||
void searchOid(QString s);
|
||||
|
||||
};
|
||||
#endif
|
||||
3
xca.pro
3
xca.pro
@ -89,6 +89,7 @@ HEADERS += local.h \
|
||||
widgets/TempTreeView.h \
|
||||
widgets/X509SuperTreeView.h \
|
||||
widgets/XcaHeaderView.h \
|
||||
widgets/OidResolver.h \
|
||||
widgets/XcaProxyModel.h
|
||||
|
||||
FORMS += ui/About.ui \
|
||||
@ -111,6 +112,7 @@ FORMS += ui/About.ui \
|
||||
ui/TrustState.ui \
|
||||
ui/SearchPkcs11.ui \
|
||||
ui/v3ext.ui \
|
||||
ui/OidResolver.ui \
|
||||
ui/RevocationList.ui
|
||||
|
||||
SOURCES += lib/asn1int.cpp \
|
||||
@ -182,6 +184,7 @@ SOURCES += lib/asn1int.cpp \
|
||||
widgets/TempTreeView.cpp \
|
||||
widgets/X509SuperTreeView.cpp \
|
||||
widgets/XcaHeaderView.cpp \
|
||||
widgets/OidResolver.cpp \
|
||||
widgets/XcaProxyModel.cpp
|
||||
|
||||
TRANSLATIONS += lang/xca_de.ts lang/xca_es.ts lang/xca_ru.ts lang/xca.ts lang/xca_tr.ts lang/xca_fr.ts lang/xca_hr.ts
|
||||
|
||||
Loading…
Reference in New Issue
Block a user