Please add fields "disabled", "expired", and "revoked" when listing keys

Issue #87 invalid
Anonymous created an issue

It would be very convenient to have fields in the dictionary that indicate, whether a key is disabled (letter 'D' included in 12th field of colon output), expired ('expires' < time.time()), or revoked ('trust' == letter 'r', I believe).

pyme seems to have this feature, and it looks very helpful, IMHO.

Comments (6)

  1. Vinay Sajip repo owner

    This information is already available in the dict. For example, keyinfo['trust'] would be 'd' for a disabled key, 'r' for a revoked key, or 'e' for an expired key.

  2. Eysl

    Thank you, this is sufficient, indeed!

    I could verify, that e and r are there, but I did not yet manage to see a d. Either, I did an error when disabling a key, or there is a bug somewhere.

    Are there unit tests for all three cases? If so, I can try to run them on my machine.

  3. Vinay Sajip repo owner

    There are no unit tests for these because the tests generate keys on the fly, and there is no way to e.g. revoke or edit keys except manually.

    What happened when you disabled a key? What value did keyinfo['trust'] have? The d information is from the gpg doc/DETAILS file.

  4. Eysl

    I have two keys disabled in my keyring using Thunderbirds enigmail. One has been fully trusted before and keyinfo['trust'] still shows an f. The other one I generated just now still shows a u. None of them shows d in python-gnupg.

    I don't know much about GnuPG, but see that the --with-colons output shows the string scESCD for those keys in field 12 instead of scESC, so this probably is the right thing to parse to get the disabled/enabled state.

  5. Vinay Sajip repo owner

    Have a look at the latest documentation, which contains a link to the latest relevant GnuPG documentation. From the latter, we see that the d in the trust field is now deprecated in favour of a D in the cap field (you'll need to use the repository version of python-gnupg to get this - it should be in the next release).

    Older gpg versions may have d in the trust field, of course.

  6. Log in to comment