Commit Graph

91 Commits

Author SHA1 Message Date
Saleem Edah-Tally
be47316219 Expand developer string. 2022-11-19 15:56:56 +01:00
SET
b9a358eb36 Transform to CMake project. 2022-10-17 07:50:41 +02:00
SET
2161e23d91 Prefer setObjectName to setId.
Wt discourages the use of setId().

See Wt commit 9eed80087aab34831932fa5a28751c137971b427.
2021-02-28 19:06:01 +01:00
SET
d6f6be678c Show localized GpgME error strings.
Using locale::global(locale("") in main().
No success with ::Context::setLocale().
2020-11-26 22:30:04 +01:00
SET
20cf898a72 Remove unused includes. 2020-11-26 22:29:43 +01:00
SET
b90ec093ad Use local scope ::Context when creating keys.
The created key was searched with FindKey(), that operates on the class
scope ::Context. The latter does not use loopback pinentry. Even though,
the created key was found, the passphrase for the created key being
cached in gpg-agent.
2020-11-26 21:03:35 +01:00
SET
608ccbc1bb Generate key data before download is requested.
Once ExportKeyStreamResource::handleRequest is entered, a 'Save As'
dialog will be opened by the browser, even if key data is empty. This
may happen if passphrase is wrong.

If key data is generated before the download is actually requested, we
can check if there is anything to push to browser and prevent the
download request.
2020-11-25 22:05:38 +01:00
SET
4d5d426f30 Remove unused function.
We don't need CheckPassphrase() anymore.
2020-11-25 21:34:18 +01:00
SET
fe7d92caef Change key event to disable export button.
With keyPressed(), no event is fired with backspace key.
2020-11-25 21:31:34 +01:00
SET
de7880ae36 Allocate passphrase on demand.
Don't store passphrase as char* member variable.
This would crash the application when exporting private keys.
See https://dev.gnupg.org/T5151#139421
2020-11-25 21:29:27 +01:00
SET
127cb7d738 Enclose subject common name in square brackets.
May be helful for log analysis.
2020-11-25 19:14:50 +01:00
SET
93bd93a0fa Improve some UI strings. 2020-11-25 12:26:14 +01:00
SET
9ca5a4cbbb Update README.
Remove information about export secret key limitation.
2020-11-24 23:54:13 +01:00
SET
b68bee813d Allow to export private keys.
Using a workaround that validates passphrase for a secret key.

With GnuPG 2.2.23 and GpgME 1.1.15, a secret key can be exported when the right
passphrase is provided. With a bad passphrase, application crashes.

See https://dev.gnupg.org/T5151

Application may validate a passphrase before invoking engine. Until it is
hopefully fixed in upstream and available in mainstream.
2020-11-24 22:19:27 +01:00
SET
b761c366f7 Merge branch 'master' into TestExportPrivateKeys 2020-11-24 20:13:23 +01:00
SET
ab4e6d85bc Log subject common name also.
May help understanding problems.
2020-11-24 19:07:54 +01:00
SET
e56d1bd6eb Fix download code.
We need not check request::continuation() for stream resource.
2020-11-23 22:03:28 +01:00
SET
e4f8ac9c3a Remove useless conditional.
Not forwarding customized message to UI in EditUidValidity().
2020-11-23 22:03:28 +01:00
SET
e14a5c19f4 Log GpgME errors.
In file WT_APP_ROOT/gpgme.log.

Independently of usual Wt logging.
2020-11-23 22:02:55 +01:00
SET
b726b89086 Use new Context::setExpire to set expiration dates.
If no subkey is found (wrong fpr) or not provided, the expiry time of 
the key is set instead.

setExpire() allows to expire all subkeys at once. Not implemented here.

Requires GPGME >= 1.15.0.
2020-11-23 11:46:41 +01:00
SET
c9defdc02a Apply some CSS makeup.
Bad keys, subkeys, identities and signatures are tagged in red.
A secret key not owned by the user is shown in bold.
Application name is bold and bigger.
Popup background color is changed to floralwhite.
2020-11-22 22:36:41 +01:00
SET
bbc62a6efa Preserve source widget on click.
Remove TreeTableNodeText from parent, store it in TreeTableNodeLineEdit
and moves it back when the latter loses focus.
2020-11-22 18:58:04 +01:00
SET
14964f9862 Validate uid certification input.
Check all input in the popup before calling KeyEdit::
2020-11-22 14:48:27 +01:00
SET
6f15ab4d06 Refractor some identifiers to be more meaningful.
m_popupUid -> m_popupCertifyUid
CertifyKey() -> EditUidValidity()
2020-11-22 14:28:52 +01:00
SET
110e5e4fb3 Allow revoking key certifications.
Certified user identities in keys can be revoked using the same popup
for certification.

Requires GnuPG 2.2.24 (not available in distro's repository, not fully
tested to date).
2020-11-22 14:22:08 +01:00
SET
898764be7b Document changing subkey expiry time. 2020-11-22 09:21:38 +01:00
SET
e9a55a1f69 Allow changing subkey expiry time.
Needs GPGME 1.15.0.
Using the same UI for changing expiry time of the primary secret key.
2020-11-21 20:59:32 +01:00
SET
82b8810f62 Allow exporting secret keys.
Requests the passphrase with a popup.

As from GPGME 1.15.0, the loopback pinentry is functional when exporting secret keys. It works fine when the exact passphrase is provided. If it's a wrong passphrase, GPGME does not generate an ::Error, but the app crashes with 'free(): double free detected in tcache 2'.

Hence, this patch cannot be committed to master.

Status : dangerous
Result : works and works not
Reason : a wrong passphrase means a crash
2020-11-20 22:41:29 +01:00
SET
bb174075df Allow to add and revoke user identities.
Using a popup with required parameters.
2020-11-19 19:16:17 +01:00
SET
43e1eff221 Add function to revoke a user identity.
Done with Context::revUid, not with UserID::revoke.

Does not remove the identity.

N.B. : if the uid is revoked a second time, Error::code is 0.
2020-11-18 20:48:15 +01:00
SET
98c4fa2b22 Use right uid string.
Correct format :
        name (comment) <email>
Was :
        name <email> (comment)

3ac566fbf was wrong.
2020-11-18 20:40:16 +01:00
SET
da3f5c3516 Add function to add a new user identity to a key.
The email parameter must have a valid email address format here, else
GPGME will refuse to create the identity. This is not the case when
creating a key, where any string is accepted.
2020-11-16 15:58:50 +01:00
SET
4aa4ec9bf3 Hide export button with successful key search.
No key is selected after this.
2020-11-16 14:44:14 +01:00
SET
3ac566fbfe Format uid string correctly when creating keys.
Correct format :
	name <email> (comment)
Was :
	name <email> comment

Though the 'comment' part was visible with the cli gpg app, it was not
shown in kleopatra and in K7.
2020-11-16 14:39:57 +01:00
SET
0e9cc34ac0 Prefer key fingerprints anywhere.
During delete process, keys were identified by Key::keyID().
It seems that collisions are possible; so use fingerprints instead.
2020-11-15 20:55:05 +01:00
SET
64b480912f Update JSON configuration file template.
Add canEditExpiryTime and canCreateKeys Json keys.
2020-11-15 20:40:26 +01:00
SET
e312ac1efd Allow exporting public keys.
Secret keys cannot be exported because the loopback pinentry mechanism
fails to work.
2020-11-15 20:32:12 +01:00
SET
9ae83ed7bd Prefer fingerprint for key anchor id.
Short key id should be reserved for UI.
2020-11-15 12:17:57 +01:00
SET
7633ef9d60 Add function to export public keys.
Expects a fingerprint to export a single public key in armor mode.
2020-11-15 11:58:07 +01:00
SET
e944da9eda Test export private keys in C++.
Result : fails.
Reason : loopback passphrase provider is never called.

With default pinentry mode, the passphrase is requested normally 
and the private key is exported. But this can't be done on a web server.

Enclosed in #ifdef DEVTIME.
2020-11-15 11:53:03 +01:00
SET
f48a3602c6 Test export private keys in C.
Result : fails.
Reason : password callback is never called.

With default pinentry mode, the password is requested normally 
and the private key is exported. But this can't be done on a web server.

Enclosed in #ifdef DEVTIME.
2020-11-15 11:04:00 +01:00
SET
5e7df13df0 Show subkey and certification algorithms.
Subkey algorithms are shown in a new table column.
Uid signature algorithms are shown in the tooltip text.
2020-11-14 15:03:36 +01:00
SET
a721bb0225 Use common code formatting style. 2020-11-14 14:46:28 +01:00
SET
a7146a07b2 Add a close button in uid certification popup. 2020-11-14 11:41:04 +01:00
SET
1c3c073ef8 Reorganize KeyEdit class.
Make KeyEdit callable by K7Main only. Does not need to used by other
classes.
2020-11-14 11:32:49 +01:00
SET
6ac7ea7c0f Reorganize code.
Move KeyEdit::IsOurKey to Tools::IsOurKey.
2020-11-14 11:25:00 +01:00
SET
bb4df1423a Move all keyring management functions to a separate class.
KeyringIO imports, creates and deletes keys. Everything is declared
private in this class, and it can be called by K7Main only.
2020-11-14 10:58:45 +01:00
SET
2b6c0960be Improve changing certification trust level.
The editing combobox should be available only for
	- all keys that do not have an associated secret key
	- the secret keys managed by the user.
2020-11-13 22:40:53 +01:00
SET
1424f31253 Ignore unknown fingerprints when certifying keys.
A fingerprint manually added in the config file may be missing in
the keyring.
2020-11-13 21:46:09 +01:00
SET
8b789b09ca Rename upload and delete classes and variables to be more meaningful.
Uploader:: -> PopupUpload
Deleter:: -> PopupDelete
K7Main::m_uploader -> K7Main::m_popupUpload
K7Main::m_deleter -> K7Main::m_popupDelete
2020-11-13 18:53:08 +01:00