Commit Graph

273 Commits

Author SHA1 Message Date
Christian Hohnstaedt
4d401792a9 OpenSSL: Avoid all FILE pointer operations, use QFile
For interoprability reason.
To enforce it, set "#define OPENSSL_NO_STDIO 1"
All file access is done by reading/writing from/to BioByteArray()
which is filled by QFile:readAll()

Drop CRYPTO_malloc_debug / CRYPTO_mem_leaks
which is unused and disabled since many years.
2021-11-13 23:53:11 +01:00
Christian Hohnstädt
6ea01e80f6 Refactor item export: separate GUI and database
Collect all export formats in pki_export.

Each export format has assigned acouple of flags, indicating,
whether they are text, concatenateable, encrypted, usable for
multiple selections or only for a single item.
2021-11-13 14:49:02 +01:00
Christian Hohnstaedt
f2fe9be3f3 Move file loading GUI element out of non-gui container class (db_*)
into GUI View widgets/*TreeView.cpp
2021-10-30 11:51:35 +02:00
Christian Hohnstaedt
c752508979 Separate XCA Warning in Cmdline and GUI 2021-09-09 21:46:30 +02:00
Christian Hohnstaedt
61fa66b129 Add digest class encapsulating EVP_MD
Enables the separation of the core classes from the hashbox widget
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
f8915fbc98 PwDialog: Split into cmdline-core and GUI
Another step to split core and GUI components
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
0c5603ec20 XcaWarning: Split into Core and GUI element
one more step to split core and GUI components
2021-06-01 17:48:37 +02:00
Christian Hohnstädt
68273d0a30 Switch from autotools/qmake to cmake
Why?
 - QT will switch from qmake to cmake sooner or later.
 - autotools are good for unix-ish systems, cmake also for
   macOS and Xcode as well as Windows and VS-code
 - Cross compiling the windows-binaries on linux
   is not very helpful to attract windows-centric
   developers.

Also drop qmake's xca.pro
Generate man-page and sphinx sources of commandline arguments
during build by executing xca (xcadoc.cpp).
Generating Version-patchlevel and git hash is now also
OS independent.
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
b20ef7f32a Diffie-Hellmann: use XcaProgress dialog 2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
82da759a4e XcaProgress: separate Cmdline progress from GUI progress
The generic XcaProgress object is used, which dynamically
creates a Cmdline progress object.
The Mainwindow replaces it by a GUI object, which integrates
into the status bar.
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
b805fc20cc ImportMulti: Fix use-after-free issue
Also remove a leftover TRACE and do not abort()
on unexpected events.
2021-05-02 18:53:52 +02:00
Christian Hohnstaedt
4aad4233b5 MainWindow: re-enable dropping a database onto the application
and also clicking on a database to open it in the current
inkarnation on macOS
2021-05-02 18:51:16 +02:00
Christian Hohnstaedt
5d4b52ac87 Fix opening a database on startup.
Commit e32fce8581
(main.cpp: mainwin must exist for read_cmdline() in GUI mode)
created the Mainwindow before parsing the commandline,
but the MainWindow constructor opened a default database if set.

With this change, the MinWindow constructor does not open a default
database. Now the default database is explicitly opened after parsing
the command line, if no other database is already open.

Rename init_database() to setup_open_database()
It is re-entrant.
2021-04-28 22:26:40 +02:00
Christian Hohnstaedt
ff7704ff0b Add context sensitive documentation
All dialogs get the "Qt::WindowModal" modality to
operate the Help window in parallel
while also blocking the dialog parent windows.

The manageRevocations() moved from model to view

The Details dialogs become more self-sufficient.
There is a statc start method that shows the dialog and
updates name and comment after accept().
This allows recursive starts of certificate details and
independence of mainwin.
It is necessary to set the current toplevel widget as parent
for the next dialog to not block the application.
2021-04-23 15:50:13 +02:00
Christian Hohnstaedt
4f706fb3de Move Help window into separate class
Start it on application start and keep it around
for context sensitive help.
2021-04-09 17:36:03 +02:00
Christian Hohnstaedt
25347fa28a OpenDb: Fix opening remote database when local DB was open
The OpenDB dialog did not show up and the previous sqlite
database was opened again.

Start the dialog without current Database preset to always show it.
2021-04-01 11:01:10 +02:00
Christian Hohnstaedt
e9edb75442 ImportMulti: Update pointer management to always free all items 2020-10-16 00:37:12 +02:00
Christian Hohnstädt
e4f9dd6389 Fix opening new database, while another one is open
Avoid crashes by checking for model being set.
Thoroughly close previous database before opening a new one.
Drop changeDB() function and replace by init_database.
2020-10-14 22:02:48 +02:00
Christian Hohnstaedt
45f834a6e4 Move tree-handling from db_x509 class to the base class
This is a preparation for possibly inserting
structuring folder elements later.
2020-05-08 17:37:40 +02:00
Christian Hohnstaedt
7c65a786ea Revamp database management
The global variable "Database" of class xca_db
can be used by any other class to access. No need
to provide it.

The "xca_db" class managed the "database_model" pointer.
Accessing the name of the current database has been unified.
2020-05-08 07:47:15 +02:00
Christian Hohnstaedt
b5c9d645e3 More native separators when displaying file names 2020-05-06 17:57:09 +02:00
Christian Hohnstaedt
b2ab7570b8 Minor fixxes and constifies 2020-04-30 18:47:28 +02:00
Christian Hohnstaedt
5a64725556 Move item store from db_base into separate class "pki_lookup"
Since also pki_base and other classes need to access them.
2020-04-30 18:37:25 +02:00
Christian Hohnstaedt
c528c37986 Merge branch 'master' into develop 2020-04-05 10:58:47 +02:00
Christian Hohnstaedt
2d0980d4f6 Use pkcs11_lib_list as model for Options:pkcs11list
Change pkcs11List from QListWidget to QListView
The pkcs11_lib_list holds the data of the loaded libraries.
For the model a QList "model_data" is used to
hold indexes into QList dirs to allow duplicates,
moves and removes.

On windows it now displays the paths with \ separators.
2020-04-05 09:16:12 +02:00
Christian Hohnstaedt
595cf9a722 Drop connNewX509() signal and slot
in the past it was used to connect the NewX509 dialog
with requests keys and certs.

The NewX509 dialog knows mainwin since some time
and thus can connect itself to models and views

mainwin: use model<T>() instead of models->model<T>()
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
ef9b3aff3d Drop superflous includes from header files 2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
241d7e9c7f Move newItem() function from model to view
Move CRL and Template data collection via UI to
the appropriate views
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
3dd34a61bc Move "showPki()" from the model class to the view
The displaying function requires UI.
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
aa55a68782 Let pki_pkcs12 and pki_pkcs7 inherit from pki_multi
And ImportMulti handles pki_multi sufficiently
and does not need to know about pkcs12 or pkcs7

pkcs12 and pkcs7 don't need: print() getCa() addCaCert() numCa()
it is handled by pki_multi()

Take advantage of the power of dynamic_cast<>() instead of using
typeid()
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
c89b6aff29 Move NID lists for ExtendedKeyUsage and DistinguishedName
into lib/oid.h
2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
c5208f1cd7 Consolidate headers, unguard delete operator 2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
e4d0ab8f8e Refactor Image and icon ressources 2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
b2a69f3586 Several fixes of previous commit
Passwd::cleanse() also resets the password size
db_base::flushLookup() now deletes all items
and pki_base does not anymore.

Drop TRACE
Colorize pki_base::print()

Set and inherit filename of loaded items
Add print() method to pki_pkcs12
and constify its methods
2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
a90d7b5b0d Improve password input handling
Unify password results
Retry on password verification error
Honor the users wish to exit
2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
176c2f8169 Improve password input and handling
Use the Passwd class instead of QString

Move password input into the database model
to be available for commandline use.

Repeat in case of wrong password
2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
113a201d39 Separate database from Mainwin for better cmdline support
New classes:
 - database_model: Manage the database tables (keys, req, cert, crl, templ)
   extracted from widgets/MW_database.cpp
 - arguments: parse commandline, dynamically create help text
2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
4ddeff337f Check whether a database schema update succeeded 2020-01-30 17:03:36 +01:00
Patrick Monnerat
262c805f2e Fix possible XCA crash
Someone experienced an XCA crash on Fedora 29 and reported it.
Unfortunately this is an automatic reporting with
no "human-generated" details.

 #5  pki_multi::count (this=0x0) at /usr/src/debug/xca-2.1.2-3.fc31.x86_64/lib/pki_multi.h:32
 #6  MainWindow::probeAnything (this=<optimized out>, file=..., ret=0x7ffdd1258a10) at MainWindow.cpp:816
        pki = 0x0
 #7  0x000000000053dba8 in MainWindow::read_cmdline (this=this@entry=0xac1000, argc=2, argv=argv@entry=0x7ffdd1258bd8) at /usr/include/qt5/QtCore/qrefcount.h:60
2019-12-04 13:43:25 +01:00
Christian Hohnstaedt
5b5c47e0a5 Related to #68: Check for a running DH param process when exiting XCA 2019-04-09 19:14:38 +02:00
Christian Hohnstaedt
b12da23e78 Close #68 Generating large DH params freezes UI
Move DH generation function into separate thread
to keep the UI responsible
2019-04-08 06:44:30 +02:00
Christian Hohnstaedt
f43e7520db Support concurrent database access.
If a database is modified by another instance of XCA the passive
instance reloads and displays the changed parts.
2019-03-25 06:47:25 +01:00
Christian Hohnstaedt
ced0995862 Close #91: Change order of "PKCS#11 provider"
With this commit PKCS#11 libraries may be reordered
and enabled or disabled.

The slot selection dialog iterates over all enabled and successfully
loaded libraries in the configured order and collects the slots
of each of them.

In the options dialog the library info is shown in the tool-tip
2019-03-21 06:12:51 +01:00
Christian Hohnstaedt
026d8f8e6d Extend PEM files by human readable information about the item
This can be enabled or disabled during export.
Move from FILE* to QFile
2019-03-18 06:25:20 +01:00
Christian Hohnstaedt
56687bfc83 Verify imported keys thoroughly
When importing keys, a verification by signing and verifying
some random data is performed now.
2018-12-06 05:50:09 +01:00
Christian Hohnstaedt
736dac6250 Close #40 macOS: Crash after xca v2.0.1 quit
If I select "Quit xca" from the "xca" menu, the application exits gracefully.
Unify code paths between "Quit xca", CMD-Q, ALT-F4 and [X] button
by calling mainwindow->close() from qApplication->quit() slot.
2018-10-29 22:24:22 +01:00
Christian Hohnstaedt
c1189b0ff4 Add private key icon to the key name
in the certificate and request table
2018-07-06 06:05:40 +02:00
Christian Hohnstaedt
40b6a00840 Retranslate Searchbox placeholder text when switching language 2018-03-31 07:42:48 +02:00
Christian Hohnstaedt
ac02da8631 Fix opening, importing and dropping databases 2018-03-15 21:48:53 +01:00
Christian Hohnstaedt
ff25461d7a Fix legacy database-without-password import 2018-03-12 16:01:57 +01:00