Commit Graph

198 Commits

Author SHA1 Message Date
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
Christian Hohnstaedt
6cf72a38e0 Remove superflous function and mark decryptKey as pure virtual 2018-03-30 14:38:09 +02:00
Christian Hohnstaedt
139d8509b4 Fix crash during PKCS#12 export
initialize property variable "key"
and duplicate the sqlItemId to enable access to the private key.
2018-03-12 21:06:21 +01:00
Christian Hohnstaedt
c2007a13ee Minor fixes: Store token in DB, Load settings, 2018-03-06 09:02:06 +01:00
Christian Hohnstaedt
d079dbde09 Collect affected items 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
24d1f85a26 Make use of C++ templates for more type-safety 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
431076c90e Change private key encryption in the database to PKCS#8 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
fbde63e98d Add Views and a concept of schema updates 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
00145600a7 Improve usecounter performance 2018-03-05 07:46:10 +01:00
Christian Hohnstaedt
fc7fc357ac Support opening remote databases MySQL and PostgreSQL 2018-03-05 07:46:10 +01:00