Commit Graph

143 Commits

Author SHA1 Message Date
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
778e5c2e3a Feature #313: Add JWK export
Export private and public keys as JWK.
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
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
Christian Hohnstaedt
0a1a21608d Close #518: Export certificates for ovpn file
Create ovpn file with "ca", "cert" and "key"
Additionally put all intermediate CAs (if any)
tagged as "extra-certs".

"tls-auth" "OpenVPN Static key V1" not supported (yet)

Extend export-test by OpenVPN test case
2024-02-11 00:29:01 +01: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
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
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
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
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
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
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
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 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 Hohnstaedt
2c38ddbd8d Set default key size to 2048 instead of 0
when changing the key type from EC/ED25519 to RSA/DSA
2021-05-07 22:30:51 +02:00
Christian Hohnstaedt
7ace0db0d5 Add ED25519 support for commandline key generation
Enable the key-job class to parse ED25519 key description
without size and EC-Group correctly.
Don't check the size parameter of ED25519 keys.
2021-04-09 17:36:03 +02:00
Christian Hohnstädt
45de747461 Add support for SSH2 ED25519 private key export
Encrypting the SSH2 private keys is not supported, yet.
2021-04-01 12:24:01 +02:00
Christian Hohnstädt
6d76fe1206 Close #142: Support Ed25519 Export private SSH2 key
Currently "PEM private" will export the key in SSH2
for PEM export into the clipboard
2021-04-01 11:02:22 +02:00
Christian Hohnstaedt
fdb2894e80 Close #142: Support Ed25519 Import private SSH2 key
Support loading OpenSSH ED25519 private key

Improve private key verification in general.
ED25519 does not support EVP_PKEY_sign(), so use
EVP_DigestSign(), which in turn only works since OpenSSL 1.1.1
resulting in a backward compatibility quirk in openssl_compat.
2021-04-01 11:02:22 +02:00
Christian Hohnstaedt
86cfff35d0 Close #142: Support Ed25519 Public export an Details
- Export SSH2 Public key
- Detect whether ED25519 key is private key
- Support ED25519 in the KeyDetails dialog
   o Display public key
   o Curve name
   o Fingerprints
   o Availability of private key
2021-04-01 11:02:22 +02:00
Christian Hohnstaedt
dbb3c48ef3 Close #142: Support Ed25519 Keygen
Support generating ED25519 keys
2021-04-01 11:02:22 +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
9183f300c8 Add support for validating a keyjob
In case of an invalid keyjob bail out.
2020-03-18 05:26:16 +01:00
Christian Hohnstaedt
919f4f6b23 Parse keytype uppercase to also allow "rsa:2048" 2020-03-18 05:26:16 +01:00
Christian Hohnstaedt
00bf676f0a Fix building for Windows
No ioctl() on windows.

Avoid initialisation race of static arrays
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
af3816a7b0 Fix building against OpenSSL 0.9.8 2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
2f917237bc Close #157 Generate and export CRLs from commandline
Enable key generation and CRL generation on the commandline
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
a48ea10e3d Split key generation and data-collection-UI
Use the key job to transfer the information
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
f1fd65c9cf Add keyjob (TBC)
Invent keyjob
2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
77519936e0 Invent keytype class for mapping type mechanism and name 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
2fbadfc9f0 Update Copyright Years to 2020 2020-01-13 07:26:46 +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
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
f55c7feee7 Constify some functions 2019-03-14 06:35:25 +01:00
Christian Hohnstaedt
a78d953338 Support ecdsa SSH public keys 2019-03-14 06:35:25 +01:00
Christian Hohnstaedt
1bc340a0ef Close #104: Also show sha256 digests of public keys
Print digest of public keys in the key details in different formats:

Print SHA256 SSH digest as used to by SSH users:
	ssh-keygen -l -f ~/.ssh/id_rsa.pub

Print SHA1 X509 key digest as shown in the
	Subject key identifier of a certificate

Print SHA256 digest as in:
	openssl pkey -pubout -outform DER < key.pem | sha256sum
as requested by this issue.

Refactored digesting functionality by a generic Digest()
function working with QByteArrays.
The function formatHash() now also expects a QByteArray input.
2019-03-14 06:35:24 +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
ed53777e78 Fix compiler warnings
clang version 3.8.0-2ubuntu4
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)
2018-10-25 16:43:19 +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
c43051df12 Improve Use counter acquirement by one SQL statement for all keys 2018-04-09 06:09:55 +02:00