Commit Graph

1324 Commits

Author SHA1 Message Date
Christian Hohnstaedt
96d1440672 Move SQL driver options to the settings.ini
Some checks failed
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 5.15.2, ubuntu-latest) (push) Has been cancelled
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 6.6.2, ubuntu-latest) (push) Has been cancelled
CMake / build (build/xca-*.dmg, Unix Makefiles, mac, /opt/homebrew/opt/openssl, macos, 6.6.2, macos-latest) (push) Has been cancelled
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) Has been cancelled
and adopt the documentation
2025-03-31 08:48:25 +02:00
Christian Hohnstaedt
02cd168d82 Move dbhistory, defaultdb and defaultlang into settings.ini 2025-03-30 21:44:33 +02:00
Christian Hohnstaedt
196219283b Improve headerlist. Don't overload isNumeric
isNumeric now is a virtual function of the dbheader class
and overloaded by subclasses if needed.

The strict connection isNumeric == AlignLeft is removed
and a new virtual function alignment() is used to return the alignment.
By default this is "isNumeric() ? Qt::AlignRight : Qt::AlignLeft;"
but can now be overridden in sub-classes.

the key_dbheader sub-class vanished an got replaced by
the num_dbheader class with the capability to set the type to hd_key
2025-03-30 11:24:39 +02:00
Christian Hohnstaedt
ab0429456d Close #645: /dev/hwrng no such file
Don't try to use /dev/hwrng. It is unreadable for most users anyway.
On modern linux systems, /dev/urandom already has received
a seed from /dev/hwrng.
2025-03-30 11:24:05 +02:00
Christian Hohnstaedt
89b7c6beea codespell: Fix spelling issues, no functional changes 2025-03-28 18:11:18 +01:00
Christian Hohnstaedt
caaea326a8 Free elements before exit of xcaexport app
Not very tragic, but the ASAN build fails otherwise.
2025-03-28 11:01:43 +01:00
Christian Hohnstaedt
f671cea71b Close #602: Linux/Flatpak: default template TLS_server is missing
Add Linux INSTALL_DATA_PREFIX to the list of search paths
2025-03-28 11:01:43 +01:00
Sertonix
37c0f0cf1a
Fix BioByteArray when char is not signed
char can be signed or unsigned depending on the arch and compiler flags. Use unsigned char explicitly to behave consistently.

Fixes 7078853573 Consolidate Bignum2ByteArray conversion implementations
2025-03-26 12:36:45 +00:00
Christian Hohnstaedt
c9184b065f Add SHA3 hash algorithms 2024-10-06 22:28:04 +02:00
Christian Hohnstaedt
24c0236e29 Sane import-error of encrypted ED25519 keys
qCritical() terminates the application. This was not intended.
Rather print a reasonable error message.
2024-10-03 23:39:18 +02:00
Christian Hohnstaedt
a8ee4660d6 Close #593: App freezes/crashes when trying to export certain keys
Break an endless loop if the size of the encrypted private key is 0

Also add sanity check when updating the private key
that it has a size > 0. This should not happen, but anyway.
2024-10-03 10:55:32 +02:00
Christian Hohnstaedt
fee6235724 Close #306 #537 Allow Database-driver options in config file
XCA tries to read Database-driver specific options from
configurartion files in the getUserSettingsDir()
named after the driver and the host.
2024-10-03 10:44:54 +02:00
Christian Hohnstaedt
53cbeea783 Close #152: How can we specify the Cryptographic Service Provider
Some checks failed
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 5.15.2, ubuntu-latest) (push) Has been cancelled
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 6.6.2, ubuntu-latest) (push) Has been cancelled
CMake / build (build/xca-*.dmg, Unix Makefiles, mac, /opt/homebrew/opt/openssl, macos, 6.6.2, macos-latest) (push) Has been cancelled
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) Has been cancelled
A comment line of the format "CSP: <Provider Name>"
in the private key will be used as CSP during PKCS#12 / PFX
export.
2024-09-30 19:07:12 +02:00
Christian Hohnstaedt
bec6623b0a Fix minor typo with positional parameter 2024-09-29 23:50:43 +02:00
Christian Hohnstaedt
5f4308245c Close #239: Check existing Name Constraints
This check is performed before the certificate is
issued and signed. Like all the other checks
regarding validity, extensions and other things.

Issuing certificates that violate the Name Constraints
of any CA in the chain is still be possible.

But there will be a warning now with the name of the affected
CA-Certificate and the violated constraint.

The Issuer can then decide whether to issue the
certificate or not.
2024-09-29 18:39:00 +02:00
Christian Hohnstaedt
97a14f2f19 Simplify issuer check and use the OpenSSL function
Apparently, OpenSSL also needs such a check - Surprise.
And they do it slightly more thoroughly - No surprise.
2024-09-29 14:20:15 +02:00
Christian Hohnstaedt
a8ebef92cb Extend Error messages by line and function
Every detail can help
2024-09-29 14:20:00 +02:00
Christian Hohnstaedt
c351612846 Chop the last newline from the hexdump of a bignum
This makes the display nicer in the details dialog
as it was before the refactoring by:
 99283bf6c0e9eb09b4378f734b97ffdcea7e66e8
2024-09-29 14:19:11 +02:00
Christian Hohnstaedt
7d3ff4f0f9 Add OpenSSL PURPOSE and validation results
A new tab on the certificate details dialog
shows the result of the OpenSSL validation process
and the calculated OpenSSL Purpose.

The translation of the OpenSSL X509_V_ERR.... messsages
back to strings is done by grepping them from "openssl/x509_vfy.h"
and wrapping them into a macro-call.
Additionally guard them by an #ifdef (Zombieland rule #2: Double-Tap)
This way:
 - I don't need to test and check in which versions of OpenSSL
   which errors are available or not
 - New errors will be picked up automatically, as long as they
   match the "X509_V_ERR_" pattern
2024-09-29 14:12:17 +02:00
Christian Hohnstaedt
006ffef3a1 Fixup for #287 - Templates don't export correctly
Introduced with 7f5bdb7dec

Templates now export again completely and
not only the internal name and comment.

Also protect against an empty internal name
by setting it to "Pasted" as last resort.
2024-09-28 15:57:05 +02:00
Christian Hohnstaedt
2b3f4dd039 Combine #90 and #315 and support UPN in name constraints 2024-09-15 09:25:44 +02:00
Christian Hohnstaedt
cb1f02502d Close #90, #361: Name Constraints (RFC5280 section 4.2.1.10)
Some checks failed
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 5.15.2, ubuntu-latest) (push) Has been cancelled
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 6.6.2, ubuntu-latest) (push) Has been cancelled
CMake / build (build/xca-*.dmg, Unix Makefiles, mac, /opt/homebrew/opt/openssl, macos, 6.6.2, macos-latest) (push) Has been cancelled
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) Has been cancelled
Conversion of name constraints from certificate to Template
(Advanced Tab) and using them from there was working since long.

Now there is an additional input line, like (and next to)
SubjectAlternativeName with live validation and edit button
with guided input.

The conversion from cert to template now puts the extension
into the correct LineEdit and not on the Advanced Tab anymore.

However, XCA does NOT follow the constraints, yet.
It is still possible to issue certificates with arbitrary
names, independent of any "Name Constraints" in the CA.

This is what issue #239 asks for.
2024-09-14 23:53:59 +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
09a2924912 OpenVPN is not PEM 2024-09-14 01:13:18 +02:00
Christian Hohnstaedt
1ac1dc0a71 Extend password write dialogs by the file name
Now the Password dialog for exported items
also shows the file name of the current export
and not only the internal name of the item.
2024-09-14 01:13:18 +02:00
Christian Hohnstaedt
c806631906 Drop the Password input message for PVK files
Encrypted PVK files are not supported anymore since
39da47c217
So the password dialog messages are also supervlous.
2024-09-14 01:13:18 +02:00
Christian Hohnstaedt
46c1b78577 Close #88: Export to multiple files
Extend the ExportFile dialog by a checkbox to
switch between "all-in-one-file" or every item in a separate
file. It is only visible if more than one file is selected.
Activating the checkbox will:
 - Change the file-input into a directory-input and cut off the
   file name
 - Disabling all formats that are intended for multiple items.
De-activating the checkbox will:
 - Change the directory-input back into a file-input
   and append the previously erased file name again.
 - Disabling all export-formats that are only useful for single items.
2024-09-14 01:13:18 +02:00
Christian Hohnstaedt
28425b6ec4 BioByteArray: add tests for new methods 2024-09-13 10:41:16 +02:00
Christian Hohnstaedt
60aefeac53 Close #313: Support JWK export format of certificates
The "x5t" and "x5t#256" properties are always present.
The "x5c" Certificate chain can be optionally selected.
2024-09-13 10:41:16 +02:00
Christian Hohnstaedt
2e70aa6329 Feature #313: Support JWK sets
When multiple keys are selected, put them all into
one file as a JWK set, which is "keys" array of JWK objects.
2024-09-13 10:41:16 +02:00
Christian Hohnstaedt
778e5c2e3a Feature #313: Add JWK export
Export private and public keys as JWK.
2024-09-13 10:41:16 +02:00
Christian Hohnstaedt
7078853573 Consolidate Bignum2ByteArray conversion implementations
Unify the different implementations of Bignum-to-QByteArray
implementations by our BioByteArray class.

Also support alignment to a minimal bitsize.
2024-09-13 10:41:16 +02:00
Christian Hohnstaedt
a3dd931fb3 Drop unneeded function BNoneLine() 2024-09-10 23:51:47 +02:00
Christian Hohnstaedt
418b78ce52 Fixup for #548: fix detection of portable app
Some checks failed
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 5.15.2, ubuntu-latest) (push) Has been cancelled
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 6.6.2, ubuntu-latest) (push) Has been cancelled
CMake / build (build/xca-*.dmg, Unix Makefiles, mac, /opt/homebrew/opt/openssl, macos, 6.6.2, macos-latest) (push) Has been cancelled
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) Has been cancelled
Don't call getHomeDir() in global constructor before main()
2024-09-08 12:17:39 +02:00
Christian Hohnstaedt
d256da3858 Fix debugging-info on Windows
The file separator bite again
2024-09-08 11:42:57 +02:00
Christian Hohnstaedt
775939b3ae Close #552: issues with icons in gnome dock
coreApp->setOrganizationDomain() expects the domain
in DNS order (hohnstaedt.de) and not reversed.

Change the WM_CLASS property to "de.hohnstaedt.xca"
via setApplicationName().
While Qt6 prepends the reversed "OrganizationDomain",
Qt5 does not and setting the complete name with
domain-prefix works for both.

Also adopt the ".desktop" file name to follow the application-name
and fix issues found by "desktop-file-validate"
2024-09-07 21:52:29 +02:00
Christian Hohnstaedt
60ca584266 Close #315 Support UPN type for EAP/802.1X certificates
Replace "UPN:" by "otherName:msUPN;UTF8:" when generating
the extension from the Subject- and IssuerAlternativeName.

Extend the Edit dialog of the SAN and IAN by the "UPN" prefix.

Replace "otherName:msUPN;UTF8:" by "UPN:" when creating a template
from an existing certificate or request.

The OpenSSL config file export, the configuration display
and edit on the "Advanced Tab" are not afffected, since
this is an XCA syntax sugar, not supported by OpenSSL.

Update documentation
2024-09-06 10:07:51 +02:00
Christian Hohnstaedt
73f1029f52 Constify extList 2024-09-06 09:24:59 +02:00
Christian Hohnstaedt
7f5bdb7dec Close #287: template don't save/restore correctly
Use the probably modified internal name of the template
in the template-details dialog before import.

Therefore the name of the qlineedit of the internal name of
all other details dialogs changed from "descr" to "description"
to match the name in the NewX509 dialog and to be found
by the "XcaDetails" class.

When exporting the template data, add the internal name and the comment
to the exported data.
The XCA template data is defined by us and can be modified.
This change is backwards and upwards compatible:
  New versions of XCA can read an old Template export and vice-versa.
2024-08-31 14:48:43 +02:00
Christian Hohnstaedt
a2ea166cac Close #351: a1int::getLong() doesn't handle all error cases
Check for LONG_MAX and LONG_MIN and throw an error if the returned value
is too big.
2024-08-31 14:48:43 +02:00
Christian Hohnstaedt
6777f7c853 Close #401: Write PEM data to a file especially for crlgen
The new option --pem-file=<filename> behaves like --pem, just that it
writes the PEM data (and nothing else) to the given file name
2024-08-30 22:17:58 +02:00
Christian Hohnstaedt
e1fbba9eaa Close #548: export certificate: error using child folder
Always initialize the working directory.
2024-08-30 22:17:58 +02:00
Christian Hohnstaedt
6bf6f4384b Automatically generate documentation of export formats
The pki_export class has all information to generate the documentation
2024-08-30 09:30:42 +02:00
Christian Hohnstaedt
9a0454b7c5 Relates #391: export expired and revoked certificates 2024-08-29 09:20:44 +02:00
Christian Hohnstaedt
b03076c474 Close #391: hide expired and revoked certificates 2024-08-29 09:10:58 +02:00
Christian Hohnstaedt
0212113424 Close #304 oids.txt not found etc if prefix non-standard
Add INSTALL_PREFIX to the header and add it to the search path
for OIDs, translations and documentation.
2024-08-25 00:47:49 +02:00
Christian Hohnstaedt
63b54f938c Add cmdline option to disable native dialogs
--no-native-dialogs disables QTs feature to display
OS specific dialogs for message-boxes and file-open dialogs.

This is currently necessary for flatpak, but may be helpful in other
occasions, too.
2024-08-24 15:09:00 +02:00
Christian Hohnstaedt
a4fc9aa110 Close #364 Export ED25519 private key with password
Allow exporting encrypted ED25519 keys.
The crypt flag was disallowed to support SSH2 export.
But since the SSH2 key is written unencrypted,
this restriction makes no sense anymore.
2024-08-24 15:09:00 +02:00
Christian Hohnstaedt
4b6965d784 Related to #364 fix writeSSH2private() function
Move writeSSH2private() and write_SSH2_ed25519_private()
from pki_key.cpp (base class for public keys)
to pki_evp.cpp (derived class for private keys)

Extend the function to write RSA/DSA/EC in traditional
format.
Remove the PEM flag from the export format to not be catched
by (PEM | PRIVATE) selector in db_key::exportItem().
2024-08-24 15:09:00 +02:00
Christian Hohnstaedt
c730a886c8 Fix #364, comment#3: Remove ED25519 from PEM line
Actually, ED25519 has no "traditional" format.
While at it, replace the switch statement by
the simpler PEM_write_bio_PrivateKey_traditional()
2024-08-24 15:09:00 +02:00