Commit Graph

254 Commits

Author SHA1 Message Date
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
Christian Hohnstaedt
421ab5840a Minor bugfixes: PostgeSQL does not like setting an integer to "true"
Display renamed request in the NewX509 dialog correctly in the dropdown
2018-03-10 10:45:03 +01:00
Christian Hohnstaedt
6e432238e7 Generalize, simplify and unify settings management
Add settings class to access the settings table in the database
Cache values and improve database writes.
Options dialog simplified
Replace getSetting / storeSetting
Unpack option flags to rows in the settings
2018-03-10 09:04:54 +01:00
Christian Hohnstaedt
484eca6f39 Simplify Index file creation and document it. 2018-03-08 06:15:28 +01:00
Christian Hohnstaedt
c62339e1ce Adapt Certificate Index creation to the new database capabilities 2018-03-07 23:00:58 +01:00
Christian Hohnstaedt
21bd5f0ee4 Support Remote database name on the commandline 2018-03-05 07:46:11 +01:00
Christian Hohnstaedt
6dcac9d571 Fix password query during database opening 2018-03-05 07:46:11 +01:00
Christian Hohnstaedt
84e4301f6d Tell the user if the SqLite driver is missing 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
d36e6eb0cb Implement nested transactions.
The DbTransaction class automatically rolls back when the scope
is left (destructor) and no commit happenned.

Every transaction begin will increment the counter,
each commit/rollback will decrement it. Only if all transactions
finished with a commit, a final database commit will be performed.
2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
24d1f85a26 Make use of C++ templates for more type-safety 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
a3900b1473 Several fixes for templates, key encryption etc. 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
e1b982a346 Replace printf by qDebug 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
fc7fc357ac Support opening remote databases MySQL and PostgreSQL 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
2a0a4630ae Extend authority table and fix CaProperties 2018-03-05 07:46:09 +01:00
Christian Hohnstaedt
4598ddb4de Convert QByteArray.base64() to QString before writing it to the DB 2018-03-05 07:46:09 +01:00
Christian Hohnstaedt
a75eb6ebd8 Avoid LastInsertID 2018-03-05 07:46:09 +01:00
Christian Hohnstaedt
4b3ee2c705 Switch database format to SQL(ite)
This is a large squash of many small commits.

Allow porting data from the legacy format to SQL.
Store Binaries base64 encoded and use db->transaction
Update password hash to be 8000 x SHA512 with 8 byte Salt
Add revocations table and fixup CRL generation
Add comment and insertion date columns

Fix column saving, remove trust, add XcaDialog
Allow changing the internal name and comment in Cert/Req details view
Extend Comment functionality, Replace About.ui by XcaDialog.ui
2018-03-05 07:42:36 +01:00
Christian Hohnstaedt
bdbaa0a946 Support Dragging certificates and other items as PEM text
Also dragging PEM test into XCA opens the import Dialog
2018-02-20 23:47:17 +01:00
Christian Hohnstaedt
eb6382d6aa Remove SPKAC support. Netscape is not of this world anymore.
I discovered some bugs in SPKAC handling and fixing them was hard.
Because of this bugs noone may have used the feature in the past.

Remove it.
2018-02-13 11:47:21 +01:00
Christian Hohnstaedt
3f35cdccf8 Cleanup the OID text files, remove senseless aia.txt
- Remove all aia.txt from the Code, Documentation and ToolTip
- Add an Operating system dependent help hint
- Replace unix LF by DOS CR-LF for windows installation
2018-02-01 00:05:40 +01:00