Commit Graph

207 Commits

Author SHA1 Message Date
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
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 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
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
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
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 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 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 Hohnstaedt
a81ee33652 pki_key.cpp: The key-type string in the database is only 4 bytes
... but "ED25519" is consists of more than 4 characters.
2021-04-23 15:57:32 +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
9cd58ff262 Close #142: Support Ed25519 Import public key
Import ED25519 key from SSH2 public key format
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 Hohnstädt
24009b13c7 Fix warnings 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
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
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
77519936e0 Invent keytype class for mapping type mechanism and name 2020-03-13 12:13:27 +01:00
Christian Hohnstaedt
98593e7462 Compatibility fixes for QT4 and OpenSSL 0.9.8
Need to drop support for those ancient libs.
Not, yet.
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
Patrick Monnerat
20b1c4fc8a Resolve gcc 9/10 new warnings.
-Wstringop-truncation:
Ensure length passed to strncpy() is < size of destination buffer. The last
buffer byte is already nullified afterwards (in db::init_header() and
db::rename()).

-Wdeprecated-copy:
Explicit define of errorEx copy assignment operator.
Explicit define of x509revList copy assignment operator.
Explicit define of slotid copy constructor.

-Wimplicit-fallthrough:
Refactor code to suppress case fallthrough in pki_key::ssh_key_bn2data().
2020-02-09 01:24:06 +01:00
Christian Hohnstaedt
2fbadfc9f0 Update Copyright Years to 2020 2020-01-13 07:26:46 +01:00
Christian Hohnstaedt
953d26c419 Close #21 Support for ODBC (MSSQL)
Add ODBC QSQL Database driver

Column "public" in public_keys table is a keyword in
MSSQL. Double quote it.
Double quotes are invalid on MySQL in non-ANSI mode.
Force ANSI mode for MySQL/MariaDB databases.

MSSQL also has a maximum VARCHAR of 8000

Schema updates are not performed for each new database.
New databases are immediately created conforming to schema:7
Schema 5 and 6 get updated to 7.
Schemas < 5 never have been released officially. (pre 2.0.0)

Switch "Database name" label to "DSN" for ODBC databases.
2020-01-13 07:24:08 +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
4199b8dfc6 Fix SSH2 public key export
Amend commit c26e7a4695
where the base64 key got lost in the output!
2019-12-16 17:14:37 +01:00
Christian Hohnstaedt
a28b943b5f Fix missing ; after return 2019-03-20 17:44:08 +01:00
Christian Hohnstaedt
1086329ee1 Fix for Openssl nno-ec 2019-03-18 06:25:20 +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
c26e7a4695 Close #98 Add comment at import/export RSA keys from/to SSH public key
When loading the SSH key add the trailing comment to the comment field
When storing the key, append the first line of the comment to the key.
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
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