Add key-selection page to AccountWizard
ClosedPublic

Authored by dvratil on Aug 9 2016, 3:19 PM.

Details

Summary

Introduce a new page to the Account Wizard where user can select a cryptographic key to be set to the newly created identity. Use can also generate a new key pair or import an existing key from file.

The page follows the Personal Data page and is only shown when the Personal Data page is enabled.

I'm wondering if I should maybe move the "Always sign/always encrypt/never sign/...." combobox from the Personal Data page to the Crypto page, since it's crypto-related...?

Diff Detail

Repository
R43 KDE PIM
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dvratil updated this revision to Diff 5775.Aug 9 2016, 3:19 PM
dvratil retitled this revision from to Add key-selection page to AccountWizard.
dvratil updated this object.
dvratil edited the test plan for this revision. (Show Details)
dvratil added reviewers: mlaurent, aheinecke.
dvratil set the repository for this revision to R43 KDE PIM.
dvratil added a project: KDE PIM.
Restricted Application added a subscriber: kde-pim. · View Herald TranscriptAug 9 2016, 3:19 PM
mlaurent requested changes to this revision.Aug 10 2016, 5:11 AM
mlaurent edited edge metadata.
mlaurent added inline comments.
accountwizard/src/cryptopage.cpp
39

QDebug is not necessary or we need to use accountwizard_debug.h

47

I already see this code in identitydialog. Is it not possible to create a class in libkleo for it ? to avoid duplicate code ?

This revision now requires changes to proceed.Aug 10 2016, 5:11 AM
aheinecke added inline comments.Aug 10 2016, 8:21 AM
accountwizard/src/cryptopage.cpp
47

I don't think so. The class is a bit misnamed but the main thing the code here does imo is create a backend job and adds error and success handling.

The one thing I see that we could put in libkleo / qgpgme would be API to have a "defaultKeyGenerationJob" that takes name and email as arguments and otherwise used default parameters. So that we have default parameters in a central place and can do the version check what kind of defaults gnupg accepts.

e.g. newer version accept key-type: default key-length: default etc. and 2.1 even has an --quick-gen-key that only takes name and email and does not need params at all.

accountwizard/src/dialog.cpp
62

I think we need to check if GnuPG is installed here, as it's optional for KMail?

An "if (!GpgME::checkEngine(GpgME::OpenPGP))"
....

should do the trick. Otherwise the other jobs will result in errors.

dvratil added inline comments.Aug 10 2016, 12:29 PM
accountwizard/src/cryptopage.cpp
47

Yeah, the overall KeyGenerationJob is a wrapper that wraps key generation + key realoding into a single Kleo::Job that can be bound to the ProgressDialog.

I'd like to hide the XML into a job in libkleo though. Maybe it would even make sense to have a more complex job that allows specifying all kinds of arguments, subkeys etc. and would generate the XML internally.

dvratil updated this revision to Diff 5809.Aug 10 2016, 2:07 PM
dvratil edited edge metadata.
mlaurent accepted this revision.Aug 11 2016, 4:48 AM
mlaurent edited edge metadata.

Seems ok for me

This revision is now accepted and ready to land.Aug 11 2016, 4:48 AM
aheinecke accepted this revision.Aug 11 2016, 10:56 AM
aheinecke edited edge metadata.
aheinecke added inline comments.
accountwizard/src/cryptopage.cpp
47

Jep, key generation is a bit horrible in gpgme ( https://bugs.gnupg.org/gnupg/issue2280 ) A more complex meta job is something I'd like to have for Kleopatra as one thing I think is really a must have feature is to generate keys with multiple UID's which the API currently does not cover.

This revision was automatically updated to reflect the committed changes.

Feedback I got after some testing:

  • From the "we want promote crypto" point of view It would be better perpend the "Generate New Key" setting so it's default if there is no Key. (An existing key should still be the default selection if one exists.)
  • When generate new key is selected, and you go back to the crypto page and next again a second keygeneration is started.

Feedback I got after some testing:

  • From the "we want promote crypto" point of view It would be better perpend the "Generate New Key" setting so it's default if there is no Key. (An existing key should still be the default selection if one exists.)
  • When generate new key is selected, and you go back to the crypto page and next again a second keygeneration is started.

Both issues has been addressed in 16.12 and master branches of kmail-account-wizard.