Commit Graph

217 Commits

Author SHA1 Message Date
Christian Hohnstaedt
cbe7709b20 Close #224: Store original path/filename on import 2020-10-16 00:37:12 +02:00
Christian Hohnstaedt
ef24c00c22 Minor fixes 2020-06-26 14:21:32 +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
1e544161f6 Eliminate the use of "mainwin" in lib/db_* 2020-05-08 11:59:09 +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
b2ab7570b8 Minor fixxes and constifies 2020-04-30 18:47:28 +02:00
Christian Hohnstaedt
0f7465dcc5 Add convenience function to convert QModelIndex to pki_base * 2020-04-30 18:46:08 +02:00
Christian Hohnstaedt
03633d7a8a Provide db class name through constructor 2020-04-30 18:44:36 +02:00
Christian Hohnstaedt
a3344100e3 Drop FOR_ALL_pki() makro and use a foreach() loop
The foreach loop iterates over all items of a type.
The iterate method is now superflous
2020-04-30 18:40:49 +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
ea453d4336 Encapsulate all BIOs in the BioByteArray class
If we have a QByteArray (ba) and must provide it to
a BIO* expecting OpenSSL function, the following
construct provides it: BioByteArray(ba).ro()
directly providing the QByteArray buffer as BIO

It also supports mixed writes:
  BIO_write(bba, buf, size)
  bba += QByteArray
2020-04-06 22:07:57 +02:00
Christian Hohnstaedt
5543ec2fb8 Merge branch 'master' into develop 2020-04-02 07:35:18 +02:00
Christian Hohnstaedt
b41d322069 Refactor native separators / and \ on windows.
Always only use forward slash /
Drop all "QDir::separator()" and "nativeSeparator()"
functions. Only use it where filenames are displayed for the user.
2020-04-02 06:12:47 +02:00
Christian Hohnstaedt
7babd609be Drop unneeded pki_base::insert()
Insert / append does not matter,
because the rows are sorted by columns anyway.
2020-03-17 05:13:35 +01:00
Christian Hohnstaedt
ef9b3aff3d Drop superflous includes from header files 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
d0d387b03e Directly display the error instead of signaling others
The XCA_ERROR() is console-compatible and can be used
without GUI
2020-03-13 12:13:27 +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
b9a8bb1a04 Cleanup: remove unused properties and declarations 2019-03-27 05:58:25 +01: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
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
d5305d33c7 Check all dates regularily whether a "view" update is neccessary 2018-06-28 14:33:30 +02:00
Christian Hohnstaedt
acea9e5c21 Fix translation of dates 2018-06-27 07:50:21 +02:00
Christian Hohnstaedt
96d8c5cf37 Generalize handling of DateTime columns 2018-06-26 23:32:40 +02:00
Christian Hohnstaedt
b10b4f7a53 Inspired by #42: display insertion date relative
Easy to find the most recent entry, because it says
"3 seconds ago"
2018-06-25 21:20:25 +02:00
Christian Hohnstaedt
efd3bff700 Add missing break in switch 2018-05-16 17:43:03 +02:00
Christian Hohnstaedt
dc36728df8 Generate calender (.ics) files for certificate and CRL expiries
Also support consolidated calendar entries for a CA,
containing the CA, all issued certificates and the CRL expiry dates.
2018-05-10 12:49:59 +02:00
Christian Hohnstaedt
8d64db6be3 Const-ify remFromCont() 2018-04-24 23:10:46 +02:00
Christian Hohnstaedt
331b79bd9d Close #23: Improve limiting to pattern in certificate tree view
CA certificates that don't match the search pattern, but have
matching childs are shown disabled with internal name.
2018-04-22 07:06:31 +02: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
14421f4ed3 Update Issuer and Key name in the Certificate, Request and CRL details
after editing double-clicked element.
2018-03-05 07:46:11 +01:00
Christian Hohnstaedt
545c955616 Add "Primary key" column to show the items internal id
Especially helpful if you want to lookup the item
in the database manually.
2018-03-05 07:46:11 +01:00
Christian Hohnstaedt
d079dbde09 Collect affected items 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
0f582044e2 More transaction 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
491a01ed1f When signing a request note it in the request-comment 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
0745e18da2 Allow to edit item properties 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
0921b63763 Fix indentation error 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
431076c90e Change private key encryption in the database to PKCS#8 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
d50dbbd726 Create indexes 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
a545659e1a Add Source column, fix Revocation management 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
fbde63e98d Add Views and a concept of schema updates 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
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
cefb140601 Switch to Qt5 for Windows build and installation
Don't depend on htonl() and friends to avoid lwsock32
Fixup WIN32 define to use the Qt definition
2017-07-17 09:27:46 +02:00
Christian Hohnstaedt
22b441046a SF: #120 Crash when importing CA certificate for certificates which already exist
The QAbstractItemModel is simetimes called with column index -1
Catch those calls.
2017-07-12 19:35:21 +02:00
Patrick Monnerat
ad6c2baae5 Add support for OpenSSL 1.1.0
The API changed heavily. New functions arrived, old functions
disappeared and many structures became opaque.

This version of the patch implements pkcs11 signing as follows:
- openssl < 1.0.0: rsa & dsa without engine
- openssl 1.0.x: rsa, dsa & ec with engine
- openssl >= 1.1.0: rsa, dsa & ec without engine

In the operation, we therefore also gain implementation of dsa signing for openssl < 1.0.0 (ec disabled because EC_KEY_METHOD was not yet invented!).

I've given up trying to use a PKEY_ENGINE with openssl 1.1: seems not possible anymore.

I've succeeded compiling the patched xca with openssl 0.9.8n, 1.0.2j and 1.1.0e.
I've successfully tested pkcs11 signing using softhsm with openssl 1.0.2j and 1.1.0e.

The patch also removes gcc7 new warnings.
2017-06-19 08:32:39 +02:00