Commit Graph

161 Commits

Author SHA1 Message Date
Christian Hohnstaedt
89b7c6beea codespell: Fix spelling issues, no functional changes 2025-03-28 18:11:18 +01:00
Christian Hohnstaedt
bec6623b0a Fix minor typo with positional parameter 2024-09-29 23:50:43 +02:00
Christian Hohnstaedt
c6304a073d Close #296: Proper plurals
Some checks are pending
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 5.15.2, ubuntu-latest) (push) Waiting to run
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 6.6.2, ubuntu-latest) (push) Waiting to run
CMake / build (build/xca-*.dmg, Unix Makefiles, mac, /opt/homebrew/opt/openssl, macos, 6.6.2, macos-latest) (push) Waiting to run
CMake / build (build/xca-*.msi build/xca-portable-*.zip , MinGW Makefiles, windows, D:\msys2\msys64\mingw64, windows, 5.15.2, windows-2019, win64_mingw81) (push) Waiting to run
Use the provided plural mechanisms of QT.
The "PO" translation also works smoothly and
the translation mechanisms between .po <-> .qt
was tested successfully.

The new english translation file translates
the single phrase:
 "Delete the %n revocation list(s): '%1'?"
into
 "Delete the revocation list: '%1'?" for one item
and
 "Delete the %n revocation lists: '%1'?" otherwise
2024-09-14 10:22:45 +02:00
Christian Hohnstaedt
0c1c00962f Fix whitespace errors 2023-12-30 11:01:11 +01:00
Christian Hohnstaedt
993da2d474 Use C++11 initializers for all non-static class members
When XCA started in 2002, there were no C++ initializers.
Drop explicit initializers from the constructors.

 - Fix indentations of section declarators.
 - Replace NULL by nullptr when feasible.
 - Sort private section: properties first, then methods.
2023-10-08 22:19:18 +02:00
Christian Hohnstaedt
52f1cf3388 Catch PEM_read_bio_* read errors
If the base64 decoding fails these function return a null pointer
without setting an openssl error.

Additionally throw an error if the PEM_read_bio functions return NULL.
2023-09-20 15:24:28 +02:00
Christian Hohnstaedt
ee842feb5e Improve windows compatibility 2022-08-31 00:01:06 +02:00
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
13b0992780 Set Key export format separately via context menu
The popping up query dialog during PEM export via Drag&Drop
and Ctrl-C during Key export was pretty annoying.
2021-10-24 14:41:25 +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
57802580c8 Drop backward-compatibility for old(<2.0.0) XCA databases 2021-05-10 20:41:12 +02:00
Christian Hohnstädt
1500e636c8 Drop OpenSSL backward compatibility hacks < 1.1.0
OpenSSL < 1.1.1 is out of support anyway
2021-05-09 12:25:32 +02:00
Christian Hohnstädt
6474d6356b Improve finding certs/requests with same key
The SELECT query now also only selects items of the required type:
 Request / x509 certificate
This avoids error messages
2020-10-14 19:48:17 +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
dcd2e1a223 Replace typeid by dynamic_cast where appropriate 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
55d1693015 Improve printing of cmdline items
Unify --print by collecting all properties
Add --pem to print the item in PEM format
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
1544065133 Extend --print and --text functionality 2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
c5208f1cd7 Consolidate headers, unguard delete operator 2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
7d0ab9d787 Add pki_XXX(const pki_XXX*) constructor
pki_XXX(const QString) -> (const QString &)
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
e4d0ab8f8e Refactor Image and icon ressources 2020-03-11 07:19:56 +01:00
Christian Hohnstaedt
2fbadfc9f0 Update Copyright Years to 2020 2020-01-13 07:26:46 +01:00
Christian Hohnstaedt
1ea45c8da4 Constify fload() fromPEM_BIO() fromPEMbyteArray()
Use "BIO_from_QByteArray()" instead of "BIO_new_mem_buf()"

Replace qSort() by std::sort()
Replace QString::null by QString()
2020-01-06 21:30:29 +01:00
Christian Hohnstaedt
8726c8b96d Improve item loading. Inspired by #153
If Loading the item results in an openssl error,
even if the item is not empty, discard it.
Otherwise loading it from the database later on will fail.

Improve "autoIntName()"
2020-01-06 19:35:11 +01:00
Christian Hohnstaedt
80affcfa61 CLose #120: Mark signed a request doesn't work
PostgreSQL requires in INT type instead of bool,
when setting the signed column.
2019-05-13 17:06:57 +02:00
Christian Hohnstaedt
4eb7b170b1 Do not reference the key by pointer, but by Key Id
This way the pointer to the key may change during reload.
2019-03-25 06:59:25 +01:00
Christian Hohnstaedt
fa704001ca Also change File loading from FILE* to QFile 2019-03-18 06:25:20 +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
e4f8f00b34 Inspired by #55: Allow manual override of CSR signed/unsigned mark
Via context menu the "Signed" flag may be toggled manually now.
2018-08-17 09:14:26 +02:00
Christian Hohnstaedt
c9cdb5d61c Close #55: Calculate "CSR signed" information from legacy database
XCA-2.x stores the "request signed" information permanently
in the database.
XCA-1.x dynamically calculated this information by looking
for certificates with the same public key.

When converting an XCA-1.x database, requests with a matching cert
are marked signed in the XCA-2.x database.
2018-08-17 06:03:52 +02:00
Christian Hohnstaedt
340b53f4fd Close #55: Add Certificate counter row for requests.
(XCA 2.x - Relationship CSR <-> issued Certificate broken)

This counter is dynamic and not stored in the DB.
In comparison to the signed flag, which is stored and
remains set in the DB, even if all certificates
issued by signing this request are deleted.
2018-08-17 06:00:40 +02:00
Christian Hohnstaedt
2682edacfd Close #48 The SKI tickbox isn't generating an SKI extension for CSRs
Since the first support of extensions for CSR (2005),
the Subject Key Identifier has been skipped.
Enable it, while still removing issuer extensions.

Better fix "Automatic X509v3 extensions for CSR"
2018-07-10 23:04:47 +02: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
bdfa10d4d5 Close #45: Unable to view Public Key
Allow displaying the public key of a certificate
or request without importing it.

When importing certificates or CRLs,
display the issuer if it exists in the database.
2018-07-01 14:58:23 +02:00
Christian Hohnstaedt
b362ae3593 Const-ify dbheader in column_data() and getIcon() 2018-04-25 09:34:45 +02:00
Christian Hohnstaedt
b74642fa09 Const-ify QSqlRecord of restoreSql() 2018-04-24 09:34:34 +02:00
Christian Hohnstaedt
6f85548c07 Drop getClassName() 2018-03-30 14:38:09 +02:00
Christian Hohnstaedt
2c20bd109a Constify and Pure-Virtual pki_base and derived classes 2018-03-30 14:38:09 +02:00
Christian Hohnstaedt
4867cfb8ab Improve "Dump database" filename 2018-03-07 05:49:46 +01:00
Christian Hohnstaedt
fbde63e98d Add Views and a concept of schema updates 2018-03-05 07:46:10 +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
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
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
dda100c100 OSSL 1.1 vs. 1.0: Private keys 2017-06-19 08:33:29 +02:00
Christian Hohnstaedt
f0c7badf0b OSSL 1.1 vs. 1.0: Store sigAlg as NID instead of Object 2017-06-19 08:33:29 +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
Christian Hohnstaedt
e5541c6d67 SF. Bug. #81 Make xca qt5 compatible
Extend XCA to also compile against Qt5
Remove directory from Qt includes
2015-09-17 18:42:42 +02:00
Christian Hohnstaedt
d55eb917e2 Silence compiler warnings about unused parameters 2015-08-11 07:17:56 +02:00