Commit Graph

1324 Commits

Author SHA1 Message Date
Christian Hohnstaedt
d29d55ab20 Close #477: paste an encrypted private key results in a crash
Improve error- and password handling:
 - Also identify: (ERR_LIB_PROV:PROV_R_BAD_DECRYPT) as password error.
 - Do not use the OpenSSL internal bitfield definition (0xff000fff)
   but the official API: ERR_GET_LIB(), ERR_GET_REASON()
   Especially ERR_LIB_OFFSET changed from 24 to 23 in Openssl 3.0.0
 - First check for "Cancel", then for invalid password to avoid
   an "Invalid Password" message after aborting the password input dialog.
2023-11-02 14:27:58 +01:00
Christian Hohnstaedt
8bd6141f0c Set OpenSSL default UI to not fallback to commandline 2023-11-02 14:05:44 +01:00
Christian Hohnstaedt
b88a20292e Move testxca target to the tests target
and remove it from the default target (all)
2023-11-02 13:50:30 +01:00
Christian Hohnstaedt
1fdc056698 Replace all C_FILE by __FILE__
It was not used consequently anyway
2023-10-31 11:45:16 +01:00
Christian Hohnstaedt
670444391d On GCC and CLANG use -fmacro-prefix-map
and skip the C_FILE strrchr() mess which failed for windows anyway.
2023-10-31 11:00:46 +01:00
Christian Hohnstaedt
41e46c1f51 ASAN: drop more ressources on exit 2023-10-30 20:01:31 +01:00
Christian Hohnstaedt
43e1b336d2 Fix crash when deleting CA certificates
If a CA certificate is deleted, all issued certificates must be moved to
an other issuer or the top-level list.

The CA cert will be taken from the model together with the issued certs
first. Then the issued certs are re-inserted.
To make this work correctly, the issuer must be erased from the issued certs
to be interpreted as insertion and not as move.
2023-10-30 01:17:50 +01:00
Christian Hohnstaedt
4fe06de78b Improve error handling in case of a wrong private password
instead of simply doing nothing.
2023-10-25 20:08:52 +02:00
Christian Hohnstaedt
e3791e2609 Add GUI test - testing the NewKey dialog 2023-10-24 17:03:09 +02:00
Christian Hohnstaedt
f28ab5c3bd Extract cmdline handling from main.cpp 2023-10-16 22:42:36 +02:00
Christian Hohnstaedt
cbaa8eba16 Extract debug_info class from main.cpp 2023-10-16 22:42:36 +02:00
Christian Hohnstaedt
cd1c14893e Revert "Warning: 'kIOMasterPortDefault' is deprecated"
But since we still support macos 10.15 we stick with it.
This reverts commit d0aee7e713c91ad4f0cb1824a4b7bfe09b5325c3.
2023-10-15 21:15:28 +02:00
Christian Hohnstaedt
432293ad23 x509name: add module test and fix memory issues
Runing module tests with ASAN makes it easier to tackle mamory issues.
2023-10-15 21:15:28 +02:00
Christian Hohnstaedt
0391e6e27f Warning: 'kIOMasterPortDefault' is deprecated
... first deprecated in macOS 12.

Rename kIOMasterPortDefault -> kIOMainPortDefault
2023-10-15 21:15:28 +02:00
Christian Hohnstaedt
d56d47e7bb Related #405: manage X509_NAME in QSharedPointer 2023-10-15 21:15:28 +02:00
Christian Hohnstaedt
2dd2477d62 Add tests for entropy and asn1time
Make a1time::get*() const, because functions return a pointer
still owned by a1time.
Switch from deprecated setTimeSpec() to setTimeZone(()
2023-10-15 21:15:28 +02:00
Christian Hohnstaedt
7db5b7049e Close #405: member functions of a1int class have memory leaks.
Manage ASN1_INTEGER pointer by QSharedPointer
Add AddressSanitizer config to the tests.
2023-10-13 23:38:23 +02:00
Christian Hohnstaedt
d36b32feac Close #402: Subject Alternative Name not filled by all CN
Iterate over all CN and add them to the SAN.
2023-10-13 00:57:13 +02:00
Christian Hohnstaedt
e2e142e012 Add some moduletests 2023-10-12 23:58:00 +02:00
Christian Hohnstaedt
80416fb0b0 Split basic functions
Extract all functions that only depend on Openssl and QtCore
2023-10-12 23:58:00 +02:00
Christian Hohnstaedt
405bc0cabf Catch invalid-key description error
This results in reasonable error message and behavior
2023-10-09 22:31:29 +02:00
Christian Hohnstaedt
fc0191a512 Disable Public key import when displaying key of cert
Importing the displayed public key of a certificate during
certificate import resulted in a double free.

The "import" flag of the key-details can now forcefully
disable the import button.

Fixing it was way more complex than simply disabling it.

Also add sanity checks for pointers that are not our childs
when creating the QModelIndex
2023-10-08 22:19:18 +02: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
4bfa81d4be More #442: Fix more leaks 2023-10-06 11:56:29 +02:00
Christian Hohnstaedt
a39c94481e main.cpp:cmd_help(): don't use exit(), but return
The exit() call resulted in a segfault when a database was open.
Folowing the "shutdown structure" by exiting at the end of
main circumvents it.
2023-10-05 23:12:40 +02:00
Christian Hohnstaedt
2333b02ddc Close #384: Quick view of certificates without trying to open XCA
The ImportMulti dialog does not show up if there is only
one item to display, but the item is displayed directly.

The displayed items have a new "Import" button to import
directly from the viewed item.

If XCA is called with certs, crls, keys etc. from the commandline
XCA only displays and optionally imports the item if a default
database is given. Afterwards XCA exits.
2023-10-05 23:12:40 +02:00
Christian Hohnstaedt
4a0f90e1b8 Drop unneeded allitems pki collector 2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
3a73697406 Drop global pointer to mainwin by fixing its last user db_x509
Instead of querying the view about the selected item,
let the view store the current item in the model.
2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
42b76418fb Enable Warnings and fix them 2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
387c238d73 Close #459: pass private key password
The password provided on the command line will be used
as automatic input of the first password dialog.

The database will be opened without requiring a password.
This results in the following bevavior:
  - crl-gen works with:
    o database password
    o private password
    o PIN
  - keygen works with database password
2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
8f05c3eac9 Close #465 Export PEM + Key in one File
Fix logical error when exporting in PEM format.
The key export part was not reached...

The diff is much smaller when displayed with -b to skip
indentation-only changes....

Drop the unused "F_PLUSKEY" flag and fix the Template export
2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
9b749d799b Close #460: Impossible to import PKCS#12 (RC40_CBC)
Unconditionally load the "legacy" provider to be able to
import legacy files like "pbeWithSHA1And40BitRC2-CBC"
encrypted PKCS#12
2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
954eec958a Improve hash selection, especially for ED25519 keys
When using a key with a hash algorithm, check whether
they can be used together. This should have been happened in the GUI.

In case of an error use the largest algorithm
2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
be31b6e22e Make XCA AppStore compliant with -DAPPSTORE_COMPLIANT=ON
APPSTORE_COMPLIANT = ON:
 - Turns off the File menu and moves the language selector to
   the "Extra" Menu. "Options" and "Exit" are at the xca-macos
   special-menu anyway.
 - Switches the signing key from "Developer ID Application" to
   "3rd Party Mac Developer Application"
 - Sets the database name to "default.xdb"
 - Adds "-appstore-compliant" option to macdeployqt
 - Picks the "entitlement-appstore-compliant.plist"
 - Disables the "Token" menu and "PKCS#11 provider" tab
   in the option dialog
2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
270152e708 Add db transaction around the removal of a CA certificate
.. to avoid an error message, enforcing each database write access
into a transaction
2023-09-30 11:24:18 +02:00
Christian Hohnstaedt
e160160395 Fix item search
Caching solution for 186657fbce
was bad. It always returned "visible" when called with unchanged
pattern instead of the last result.  Cache the last result
in "iamvisible": 0=no, 1=yes, 2=one-of-my-children and return
the cached value as long as the search pattern is unchanged.
2023-09-24 13:29:11 +02:00
Christian Hohnstaedt
e39be9b4e9 Close #423: parameter --name is not respected when running with CLI
Evaluate --name argument when generating the CRL.
Add --import-names option. This allows to name the imported items
individually, even if one PEM file contains multiple items.
2023-09-24 00:34:46 +02:00
Christian Hohnstaedt
cccc8ee1e3 Close #440: yellow background makes date text hard to read in dark themes
Adapt red and yellow background colors depending on the used theme,
detected by: "Text color lighter than Background color?"
2023-09-23 12:28:15 +02:00
Christian Hohnstaedt
e8cd69c45d Drop references to iostream
github actions seem to fail because of iostream.

Do not analyze the details for hours, but drop the
last iostream references and hope it helps.

iostream was not the culprit. Keep this change anyway,
since it makes sense and unifies stdout access.
2023-09-23 12:27:00 +02:00
Christian Hohnstaedt
c3f58d402f Close #437: loading CRL at startup generates an error
Extend B64_BLOB from "VARCHAR(8000)" which was a good
common value - until I realized that CRL may become pretty large.

Use "TEXT" for all databases but MariaDB, where LONGTEXT is used.

Add database type check via SQL query to detect the
correct database even behind an ODBC Driver.
2023-09-21 21:42:54 +02:00
Christian Hohnstaedt
65b10c33ce Close #444 cannot update template internal name
Update internal name, even if they seem unchanged
if the force option is set.
2023-09-21 20:58:14 +02:00
Christian Hohnstaedt
03a61dcc2b Fix crash while duplicating templates
A non-empty parent pointer now indicates that this
item is already inserted in the tree-view.
Duplicated templates are not. Do not copy the parent link
in the constructor.
2023-09-20 23:08:54 +02:00
Christian Hohnstaedt
26d5c73806 Improve EVP_PKEY_check()
According to the documentation EVP_PKEY_check() may
return -2 if the algorithm is not supported.
This has been observed with OpenSSL-1.1.1

See also b96951fdfd
2023-09-20 23:03:57 +02:00
Christian Hohnstaedt
c1bee8b38d Close #442: asan checks failed
Enable ASAN with -DADDRESS_SANITIZER=ON
Fix all findings inside XCA.
2023-09-20 21:08:44 +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
65f2676939 Q_OS_MAC is deprecated 2023-09-19 23:39:03 +02:00
Christian Hohnstaedt
2b59f07b1a Make sure QT_MESSAGELOGCONTEXT is always set. 2023-09-19 23:35:27 +02:00
Christian Hohnstaedt
99a7768fd9 Improve/Fix database loading
Do not interact with the GUI when loading datbase items (beginInsertRows,
beginMoveRows, beginRemoveRows, etc.) by not using
insertChild() / remFromCont() anymore.

Fill and organize the root- tree- and sub-items and call
columnsContentChanged() once when done.

Automatically set "parent" of a pki-item when inserting or removing
as child items.
2023-09-19 16:43:24 +02:00
Christian Hohnstaedt
441bc8630d Really erase element after deleting 2023-09-19 16:42:25 +02:00
Christian Hohnstaedt
dfb2489a78 Select newest issuer when importing certificates
When looking for issuers of an imported certificate, don't use the
first matching, but pick the one with the highest "notAfter" date.
2023-09-19 16:30:28 +02:00
Christian Hohnstaedt
b96951fdfd Improve EVP_PKEY_public_check()
According to the documentation EVP_PKEY_public_check() may
return -2 if the algorithm is not supported.
This has been observed with OpenSSL-1.1.1
2023-09-18 18:14:03 +02:00
Christian
d36eefaa7b Use correct free() function
EVP_PKEY must be freed by EVP_PKEY_free()
2023-09-15 10:48:05 +02:00
Christian
da01866fc2 Templates: Only support PEM like export format
PEM Format supports adding comments in comparison to binary.
Still support reading older, binary formatted templates.
2023-09-10 09:47:45 +02:00
Christian Hohnstaedt
11a88781f9 Merge branch 'vertical-align-fix' of github.com:gentoo90/xca 2023-05-30 18:39:35 +02:00
gentoo90
1e06d60f8e Fix vertical text alignment in the tree views 2023-05-30 18:41:11 +03:00
Christian Hohnstaedt
061f676041 Improve/simplify item import
Unify import functions for some (on_butImport_clicked)
or all (on_butOk_clicked) items.
They both call "importIndexes(const QModelIndexList &indexes)"
containing some or all indexes to import.

db_x509.cpp: Only need to search the treeItem (containing all items
without issuer, not all in the rootItem (containing also certificates
with known issuer)

Re-use "remFromCont()" when stealing items from an other CA.
2023-05-30 14:38:55 +02:00
Christian Hohnstaedt
1176a35fa7 Debugging: allow to select/deselect debug messages
Inspired by the Linux kernels dynamic debugging.
2023-05-28 15:31:33 +02:00
Christian Hohnstaedt
827db695b2 Close #368: error while creating CRL with CA using EC key (ed25519)
This fix differs from the proposal in #368 because the signature
of pki_crl::sign() changed after the 2.4.0 release.

However, I was able to increase the bug impact!
Now it crashed instead of only throwing an error! :-)

The signature of the pki_crl::sign() method changed with
commit 61fa66b129, but C++
"outsmarted" me and automatically transformed the EVP_MD == nullptr
into the digest::constructor(EVP_MD) which crashed on the nullptr.
2023-05-25 22:20:27 +02:00
Christian Hohnstaedt
8f277ea781 x509v3_ext: Improve error-checking
Validate SAN, IAN, AIA, CRLDP during rollout.
Fix tab-switching when validating new certificate context.

Also work with X509_EXTENSION being nullptr
2023-05-25 22:18:48 +02:00
Christian Hohnstaedt
4a81525dd1 Add missing smartCard entry
Otherwise "--list-items" displays an "unknown"
2023-05-19 22:56:17 +02:00
Christian Hohnstaedt
d8da9dd786 Really exit the application, when clicking exit
The password-input dialog of the database has an exit button.
It now really exits the application.
2023-05-19 22:54:20 +02:00
Christian Hohnstädt
5a92f68057
Merge pull request #428 from driseley/fix-cka-id-handling
Treat CKA_ID as byte array, not Bignum
2023-05-19 18:18:54 +02:00
Yaroslav Isakov
46c0f7ed25 Fix OpenSSL 3.0 engine asking two times for sign
In commit 9767a3dca7
OpenSSL changed sign behavior, that now it calls sign mechanism two
times - first with NULL output buffer, to get size of it, for next call.
This causes two sign operations in token for ED25519, so, let's detect
NULL buffer and return size of signature.

I haven't tested other type of keys - it's possible that they have
the same issue.
2023-05-16 09:49:46 +02:00
Christian Hohnstaedt
02fc95c70b Reset parent pointer when removing child from container
and use the issuer as parent when inserting it to
put it under the correct issuer
2023-05-16 09:49:46 +02:00
Christian Hohnstaedt
ab17dfd52f Simplify key checking algorithm
Since we dropped OpenSSL < 1.1.1 support, we can use
 EVP_PKEY_public_check() and EVP_PKEY_check()

Thanks to discussion in:
acb75afa6d
2023-05-16 09:49:46 +02:00
Christian Hohnstaedt
d606254f7a Additional attributes when printing PKCS#12 content 2023-05-14 21:49:49 +02:00
Christian Hohnstaedt
7206024d6a Fix deprecation warnings
The proposed "addAction()" with the KeySequence as 2nd argument
is only available soince Qt6.3 and not compatible with QT5
Change the call in a compatible way and set the shortcut afterwards.
2023-05-14 21:49:13 +02:00
Christian Hohnstaedt
fa0d67b26c Adaptions for QT 6.5 and macos
- Create universal binaries
 - re-create menubar to avoid duplications during language change
 - Select MACOS SDK 11 when using  QT-6.5 requiring it.
2023-05-14 21:41:47 +02:00
Dave Riseley
5f8176a134 Treat CKA_ID as byte array, not Bignum 2023-05-09 17:48:31 +01:00
Christian Hohnstädt
2ba114d393
Merge pull request #389 from sake/pkcs12_algo
PKCS12 encryption algorithm setting
2023-01-22 20:02:22 +01:00
Boris-Chengbiao Zhou
eb66836583 Fix command line parsing
Expected CLI option arguments weren't passed to the QCommandLineOption
constructor.
2023-01-08 00:54:35 +01:00
Tobias Wich
706ad7bf36 Add note where to find allowed PBE encryption schemes for PKCS12 2022-10-06 15:38:56 +02:00
Tobias Wich
097cbfb815 Add PKCS12 enc algo setting and use it when exporting PKCS12 2022-10-06 15:32:30 +02:00
Tobias Wich
ef8d90e5c5 Add PKCS12 encryption algorithm class 2022-10-06 15:15:11 +02:00
Tobias Wich
48acc326be Add PKCS12 encryption algorithm class 2022-10-06 15:01:16 +02:00
Tobias Wich
401b1a7a2b Use PBE algo for key and cert encryption in PKCS12 2022-10-06 11:25:25 +02:00
Christian Hohnstaedt
bd61f44e02 Refactor source file inclusion
No libraries needed. Just put all files as source to xca
and those needed for xcadoc to the xcadoc target.
Github Action: create deployments for each matrix result
2022-09-07 20:01:25 +02:00
Christian Hohnstaedt
ced6dfc41a Add support for Qt6
XCA now supports both, Qt6 and Qt5 down to Qt-5.2

Use CMAKE_PREFIX_PATH to point to the QT dompiler directory like
$ cmake -B build -DCMAKE_PREFIX_PATH=$HOME/6.3.1/gcc_64
2022-08-31 00:09:37 +02:00
Christian Hohnstaedt
ded935b033 Prepare for Qt6: QRegExp -> QRegularExpression
QRegExp is deprecated and needs special library
in Qt6: core5compat

Replace by QRegularExpression which has been introduced by Qt5
2022-08-31 00:01:06 +02:00
Christian Hohnstaedt
ee842feb5e Improve windows compatibility 2022-08-31 00:01:06 +02:00
Christian Hohnstaedt
0a54a0ad04 Fixup for #67: Password input dialog
Also ask for password when called with database on commandline
Ask for password repetition if a new password is typed
2022-08-31 00:01:06 +02:00
Christian Hohnstaedt
1c5429160f Close #321 - extend commit d289f83a6d
If the digest name is not empty and not understood by openssl
raise an error immediately.
If the nid id NID_undef make sure no openssl-error is stored
in the error list.
2022-08-31 00:01:06 +02:00
Yaroslav Isakov
d289f83a6d Fix #321 - decryptKey shows OpenSSL error, which were raised before 2022-08-30 23:45:00 +02:00
Yaroslav Isakov
31e6fdd3ef Fix OpenSSL 3 compatibility in ED25519 smartcard code
Also, use proper defines instead of EC one
2022-08-06 22:36:33 +02:00
Christian Hohnstaedt
186657fbce Close: #366 Not Responding after upgrade
cache the results of visibility check as long as the search text remains.
This function is called many times when displaying the data,
even if the search string does not change.
2022-08-03 07:36:33 +02:00
Christian Hohnstaedt
ed475c8d9f Close #327: "Dump database" dumps everything to everywhere
Select the items to be dumped to the currently selected
directory.
2022-07-31 13:02:29 +02:00
Yaroslav Isakov
6d098460d6 Support importing ED25519 keys and signing with them, using PKCS#11 tokens
What works:
- Importing ED25519 Signature key from Yubikey token (OpenSC with openpgp driver, key generated via gpg)
- Creating self-signed certificate for CA, for Signature key from card
- Signing Certificates using new CA

I haven't tested other features, e.g. storing new certificate on card, so, they're probably broken
2022-07-28 22:54:32 +02:00
Melg Eight
3f6b0105a3
Enable usage of hashAlgo digest selected by user for CRL sign
Signed-off-by: Melg Eight <public.melg8@gmail.com>
2022-02-15 19:24:47 +03:00
Christian Hohnstädt
0d26913f40
Merge pull request #334 from melg8/fix_pkcs_8_private_key_encryption
Enables usage of aes_256_cbc for private key export
2022-02-11 22:00:00 +01:00
Melg Eight
7bef74fb74
Enables usage of aes_256_cbc for private key export
Signed-off-by: Melg Eight <public.melg8@gmail.com>
2022-02-10 10:27:24 +03:00
Melg Eight
3eeb33cb07
Fix new/delete mismatch 2022-02-09 05:37:04 +03:00
Christian Hohnstädt
06fbe10d24 cmake: fixup undefined variables
Remove unused variables, define variables for all platforms
and fix typo
2022-01-03 20:03:31 +01:00
Christian Hohnstädt
e92031cf0d Drop debugging output 2021-11-20 02:12:02 +01:00
Christian Hohnstaedt
c66354ec9d Close #317: "Please insert card: ..." message
... when multiple PKCS#11 slots are present

Use the same pkcs11 instance to close the session.

Kudos to Christian Svensson for not only finding and reporting
but also fixing this issue.
2021-11-19 09:41:40 +01:00
Christian Hohnstädt
44bf1b4e84 Fix detecting the language directory 2021-11-18 22:42:41 +01:00
Christian Hohnstädt
284b1fa3f4 Call getHomeDir() later, after global constructors
This helps getting the directory of the executable
for judging whether we are the portable app or not on windows
2021-11-17 21:50:44 +01: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 Hohnstaedt
25d2fdabb2 Fix and improve building help and documentation
- Always build html documentation if sphinx-build is available.
  to be installable during install
- Collect "${D}/qthelp/xca.qhc" "${D}/qthelp/xca.qch" in QTHELP_IDX
  and use this instead.
- On linux also install the qthelp in an html subdirectory like WIN32
- Don't instanciate QHelpEngine if no help available.
2021-11-13 14:49:02 +01:00
Christian Hohnstädt
435602d524 Convert to native separators in calendar items 2021-11-13 14:49:02 +01:00
Christian Hohnstaedt
a70ffe4ff1 Move XcaDialog call from x509_super to XcaWarning 2021-11-13 14:49:02 +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
6efba2bb3e pkcs7: Fix endless loop when loading PKCS#7 via PEM import 2021-10-30 11:51:35 +02:00
Christian Hohnstädt
be1a44d0a8 Consolidate export types and format in pki_export class
Move the descriptons from the ExportDialog into the
new pki_export class.

Also translate the exportType::etype to F_* flags
2021-10-30 11:51:35 +02:00
Christian Hohnstädt
8271a1a3e8 MacOS: Fix location of translations 2021-10-24 17:57:23 +02:00
Christian Hohnstädt
3e858c877f Merge remote-tracking branch 'github/master' into main 2021-10-24 14:56:38 +02: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 Hohnstädt
810b5509b1 pem_format(): Move private key cases to pki_evp
Support "exportType::PKCS8_encrypt"
2021-10-02 08:21:52 +02:00
Christian Hohnstaedt
c752508979 Separate XCA Warning in Cmdline and GUI 2021-09-09 21:46:30 +02:00
Christian Hohnstaedt
e9f36fc72b Move storeItems() from db_base to XcaTeeView 2021-09-09 21:30:06 +02:00
Christian Hohnstädt
56c6df6c90 editComment: Move Gui elements to widgets/XcaTreeView
Another step to separate GUI from functionality
2021-06-19 13:18:48 +02:00
Christian Hohnstädt
8c0a5adc3a
Merge pull request #288 from PF4Public/pf/replace
Replace certificate while renewing
2021-06-04 08:50:58 +02:00
pf
8af3cabfa8 Replace certificate while renewing it
This commit also changes the default state of
the "Revoke old certificate" checkbox to unchecked.
The reasoning for this is that by renewing a certificate
its lifetime and subsequently validity are prolonged,
which therefore implies equal trustworthiness
for both new and old certificates, which does not intend
the revocation of the latter.
2021-06-01 20:25:13 +03:00
Christian Hohnstaedt
8cdc15aa39 Move database_schema.cpp from widgets to lib
there are no GUI elements in database_schema.cpp
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
a233ec89f9 QObject: Add Q_OBJECT macro where necessary 2021-06-01 17:48:37 +02:00
Christian Hohnstädt
52bf30e47b Visual Code adaptions 2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
0e5af2e452 Replace check_oom() by Q_CHECK_PTR()
Qt offers the functionality. No need to invent it ourselves.
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
915a920de8 cmake: Split CMakeLists.txt into the different sub directories
mv cmake/sphinx-documentation.cmake -> doc/CMakeLists.txt
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
9180a3ea31 Move font information from db_base to TreeView 2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
cfe788d362 Don't store the current locale ourselves. QLocale() does the job
This also seperates UI from the core.
After calling QLocale::setDefault(), the empty QLocale constructor
returns the current default locale.
This is now used instead of XcaApplication::language()
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
f5f6b57df4 Fix translation handling.
Use "i18n" instead of "translations" as subdirectory.
Expect "i18n" being a directory.
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
e066619a08 Close #283 Nitrokey HSM2 can't create EC keys on 2.4.0
Correctly create NewKey list items for smart-cards mechanisms.
use the PKCS#11 ID t.mech as parameter for CK_MECHANISM_TYPE
instead of t.type, which is an OpenSSL ID.
Both are numeric, so the compiler didnot complain.

For RSA it worked accidentally, because
type:EVP_PKEY_RSA == mech:CKM_RSA_PKCS_KEY_PAIR_GEN == 0

Bug introduced after 2.3.0 with
77519936e0

Set the mechanism of ED25519 to CKM_VENDOR_DEFINED, because ED25519
is not supported by PKCS#11 and 0 means CKM_RSA_PKCS_KEY_PAIR_GEN.
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
00926e3efd Get rid of libltdl. QLibrary provides the same functionality 2021-06-01 17:48:37 +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
4e2a4b7d1a Move default keyjob from NewKey to the keyjob class
another step to separate widgets from the core
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
731d866bcb Drop more unneeded includes 2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
9c49c9949f Consolidate and document used environment variables
Rename XCA_SPECIAL to XCA_ARGUMENTS, which is less generic.

and change %1_OPTIONS to XCA_%1_OPTIONS to prefix all
XCA related environment variables with "XCA_".
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
487f5e2046 Cleanup: Drop many superflous includes and unused loadImg() function 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
f1c0e96435 Cmdline: no-gui autodetect: also detect --crlgen=xxx as nogui 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 Hohnstädt
1adcceaa66 Drop OpenSSL backward comatibility for NID_tlsfeature
it was not defined for OpenSSL < 1.1.0
which is not supported anymore anyway.
2021-06-01 17:48:37 +02:00
Christian Hohnstädt
d8283d8ab5 Read oids: Avoid out of range access when reading OIDs
..and catch openssl_error()s when reading the OIDs
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
2621d20d22 make dbhistory independent of GUI widget OpenDb
the "lastRemote" database is not GUI specific and
has been moved from "OpenDb" to the non-gui class dbhistory,
which in turn becomes independent of OpenDb
2021-06-01 17:48:37 +02:00
Christian Hohnstaedt
7f431ccbd6 Fix typo introduced with 5f1d3945 to query the database password
Opening a database now again asks for the password
2021-06-01 17:29:30 +02:00
Christian Hohnstaedt
2635b91033 WIP 2021-05-25 21:10:54 +02:00
Christian Hohnstaedt
03769bef56 Add commandline option "select" to 'print', 'pem' or 'text'
can be used to export or display items.
2021-05-24 22:22:51 +02:00
Christian Hohnstaedt
802a8787cf Adaptions to stay OpenSSL 3.0 alpha16 compatible 2021-05-12 08:49:28 +02:00
Christian Hohnstädt
3bce3ae1d6 Fix travis build
Add qttools5-dev-tools qttools5-dev
Fix warnings found by travis
2021-05-12 00:03:52 +02:00
Christian Hohnstädt
00e592d8f3 Sort output of "--issuers" and "--list-items" by primary key
This is also somehow a sort by inserting date.
For more detailled displays a sqlite browser should be used.
2021-05-11 12:07:40 +02:00
Christian Hohnstaedt
ccfad6a1c3 Replace qWarning()s by qDebug() 2021-05-11 12:07:40 +02:00
Christian Hohnstaedt
7e72d8c02c Commandline: Add "--list-items" to print a list of database items 2021-05-11 12:07:40 +02:00
Christian Hohnstaedt
5f1d394530 Close #67: possibility to ignore password prompt from CLI
XCA automatically checks whether the current arguments need
a password
2021-05-11 12:07:40 +02:00
Christian Hohnstädt
8daf06dcac Close #259: Follow the XDG base directory specification
After dropping Qt4 support, the Qt5 QStandardPaths class
can be used to replace my implementation of directory discovery.

QStandardPaths follows the XDG specification.
2021-05-11 12:04:46 +02:00
Christian Hohnstaedt
7d564132ba Move ca-properties dialog to the certificate view
Reduce UI from QDialog to QWidget and display it in the XcaDialog frame.
Also move user interface specific code from the db_x509 class
into the CertTreeView class
2021-05-10 20:41:12 +02:00
Christian Hohnstaedt
523fa64486 asn1ToQString: use OpenSSL's ASN1_STRING_to_UTF8()
instead of my own implementation.

Please don't ask why I didn't look for such a function
before. I don't know.
2021-05-10 20:41:12 +02:00
Christian Hohnstaedt
57802580c8 Drop backward-compatibility for old(<2.0.0) XCA databases 2021-05-10 20:41:12 +02:00