google / end-to-end

End-To-End is a crypto library to encrypt, decrypt, digital sign, and verify signed messages (implementing OpenPGP)
Apache License 2.0
4.13k stars 298 forks source link

Extension: In the encryption/sign dialog, show recipients taking account for the key capabilities #181

Open koto opened 9 years ago

koto commented 9 years ago

From koto@google.com on September 02, 2014 17:13:48

In the keyring, for given User IDs we might have public/secret (sub)keys that can only encrypt/sign or verify a message. There is no guarantee that we can encrypt a message for every user id in a public keyring. For example, some keys might have been revoked,expired or just missing.

We should not allow the user to choose a user Chip as a recipient, if we don't have an encrypting key for that user.

Steps to reproduce:

  1. Import the following key - passphrase 'koto'
-----BEGIN PGP PRIVATE KEY BLOCK-----   
Version: GnuPG v1.4.11 (GNU/Linux)   

lQH+BFN59MYBBADM7mCostQwhkC1vP/2AkQtgnYLXy2MJFjXi4hFzQdRYhXLIy4H   
YXtW/G7pt1ofq5mSnCIzLTAwT0B0W4bN+NFi8cRatXjHPNWD8I1XieYLVLQcFnqo   
IqhbFsylZ9XVCMcDnQjyPPGj/BMSz74bwduJnIUMc8l6UUq8So38NKSxsQARAQAB   
/gMDAtTk3JAyrlOEYPV+u8pbYRdn040Famo2wQ32gi4dPU2Eg9DtZLZVr1iircmM   
k1+/3hvtVSQcu/ghUfZMwGJkoq8pWN+6S6QMVLPphiYLB7csrOjeplzZzAuLiBfk   
ai842nRLS9nEcny2xdv3793nCNaiWxddkPYUBnFguYX7FRzNvifpyeMgJYwhTfip   
BmC6s+Hu15J42Y7dWOqxXu1HbahoYYXZ1q9jatgpkNe4t8V28ODONGwtcYeEF2F2   
rPOOHOFEf1sBUJTM/ve827W7e89c7yroIP7834YEGrHYuhUp6gyvlxi79wBnfUJd   
wVsf2bPhkwqef43dv7zL1NjpP1QaZ9WOdUjlo2twKPlZ+RHBsvNKMLy0u2yDLRel   
N0QT1FmZtL11gv5PvIsl5JMeiJhfROX216UuWJtQh+YnXqm75tfz+xwWvBRueOzD   
bJ30aCBps65m4GnEni8//6tB7DZa7W3sGpRuAOJsqu/wtB5r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
50tTb6d1N0OfZiTOY/qJfoCCE2ypDgDYQdVEtXuuvzi9CYhxHgK75YJ9YQ2hoPgb   
3o4byXmMe3xJDwIAWAkTk3WWegazq6sz5TaK+AMk3LGOXFDkDdusJxBX3LApZnF8   
CpwhEQ2vh+wKNgyo0Q==   
=ItAK   
-----END PGP PRIVATE KEY BLOCK-----   
  1. Try to encrypt the message.
  2. Enter koto+rsa in the recipients list

What happens:
You can choose koto+rsa identity. Encrypting the message will however only encrypt to senders' key, because koto+rsa UID has no public key to encrypt to.

What should happen:
koto+rsa Chip should be a red chip or should not show in the UI at all.

Original issue: http://code.google.com/p/end-to-end/issues/detail?id=144

koto commented 9 years ago

We need to expose getValidEncryptionKeys in ContextImpl or make TransferableKey.toKeyObject() expose information whether a valid encryption (sub)key is present and filter based on those.

Same for signing.

koto commented 9 years ago

This is taken into account for the Keyringv2 design.

sirdarckcat commented 8 years ago

closing up old bugs, please reopen if you would still like to see it fixed

sirdarckcat commented 8 years ago

this seems useful, sorry I shouldn't have closed it