User should be able to attach his/her public key when composing a new email.
User has to go to OpenKeychain, (key), advanced, share with, K-9 Mail. (Assuming the key is not uploaded to a keyserver)
N/A
K-9 Mail version: 5.108
Android version: 6.0.1
Account type (IMAP, POP3, WebDAV/Exchange):
N/A
The potential enhancement I see here is for OpenKeychain to list itself as a source of files - much like the Photos app does. That would be an OpenKeychain enhancement, not a K-9 one.
What are you expecting K-9 to do here given it does not store the keys themselves.
It might require some work on OpenKeychain. Essentially a 'attach pub key' button would ask OpenKeychain for the public key which is then added as an attachment to the mail by K-9 mail.
Update: Your suggestion seems easier to implement. If OpenKeychain lists itself as a source of files that cointains your public keys it could be used by any app.
I feel like OpenKeychain implementing itself as a content provider for files and allowing you to pick whichever you like is less cluttered. Space is already a concern.
Unless there's something different to attaching a key versus any other file I don't see the point in doing it differently.
Yes that'd be easier, I'll open up a new issue for OpenKeychain
Actually, the key to attach is already known to k9 at the point of selection (it's configured) so there is not really something to select beyond the intent to attach a key, _and_ it's indeed sort of a special case since it can be treated on receiver side as a trigger for opportunistic encryption.
@Valodim Would it be difficult to implement this?
But you need the key in a useful file format so you'd have to have more intents for that. I feel like it's better for OpenKeychain to just define itself as a file provider. Then any app can be used to distribute public keys and K-9 users can use the attachment interface like normal.
there already is an ACTION_GET_KEY in the api, as this was implemented before
I'd envisage OpenKeychain above the 'Photos' entry in this example

I just think you're adding unnecessary complexity to the cramped Compose interface when what you're actually doing is just attaching a file like normal.
The workflow is only loosely related to attaching a file, since the user does not actually select a file.
If OpenKeychain would act as a content provider, it would be easier to share the key through other apps as well. Currently, it requires the user to dig through the 'advanced' section.
On the other hand, attaching the public key is something people often forget with PGP. So it might be better to have K-9 Mail attach the key by default when sending encrypted/signed emails.
Most helpful comment
If OpenKeychain would act as a content provider, it would be easier to share the key through other apps as well. Currently, it requires the user to dig through the 'advanced' section.
On the other hand, attaching the public key is something people often forget with PGP. So it might be better to have K-9 Mail attach the key by default when sending encrypted/signed emails.