cryptobot-email icon indicating copy to clipboard operation
cryptobot-email copied to clipboard

Key lookup is brittle

Open liliakai opened this issue 10 years ago • 0 comments

Currently when bot.py looks for it's own key it matches very strictly against the configured name and email:

    expected_uid = '{0} <{1}>'.format(config.PGP_NAME, config.PGP_EMAIL)
    fingerprint = gpg.has_secret_key_with_uid(expected_uid)

If I happen to change cryptobot's pgp name in config.py it will fail to find its own key. Same if I generate a gpg key with something in the comment field, e.g., "Crypto Bot (TEST) [email protected]".

Suggest modifying GnuPG::has_secret_key_with_uid to list all keys for config.PGP_EMAIL and take the first one. For bonus points, add a key id config, just in case you have generated multiple keys for cryptobot.

liliakai avatar Feb 26 '14 02:02 liliakai