Skip to content

fix: only encrypt to subkeys that are marked for encryption - #8051

Closed
link2xt wants to merge 1 commit into
mainfrom
link2xt/look-at-key-flags
Closed

link2xt wants to merge 1 commit into
mainfrom
link2xt/look-at-key-flags

Conversation

@link2xt

@link2xt link2xt commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

Comment about expiration dates is removed,
we will take expiration dates into account when we start merging subkeys.

Closes #6520

Comment about expiration dates is removed,
we will take expiration dates into account when we
start merging subkeys.
@link2xt

link2xt commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator Author

This is just to close old issue, I think we should not merge this until 2.47 and follow-up bugfix releases are out.

Comment thread src/pgp.rs
.signatures
.iter()
.any(|signature| signature.key_flags().encrypt_comms())
})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering, if all the subkeys are expired, will this mean that the receiver is not able to decrypt messages anymore all of a sudden?

For many years, we were on the position of "if the key is expired, just use it anyways, there is nothing better we can do". Maybe we should extend the logic to use expired subkeys if there is no non-expired subkey?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test in #8744 that makes sure we fail to select any subkey in case there is only an expired subkey.

I don't think we should encrypt to expired subkeys. Expired subkeys should be deleted by the receiver, so this may as well result in undecipherable message, we cannot assume that receiver keeps the key forever. So not being able to send a message may be better than sending it to expired subkey.

Having only one expired subkey is a common problem with GPG because it by default offers the user to create a single subkey that expires in 2 years. Then for 2 years everything works and after 2 years encryption suddenly breaks and it was somewhat ok to ignore the expiration and just send to expired subkey instead of not encrypting.

For Autocrypt2 we are going to make sure that there is always a non-expiring subkey, so we will not have this problem anyway.

@link2xt

link2xt commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

Replaced with #8744, i will also test the case of having only expired subkeys there.

@link2xt link2xt closed this Oct 7, 2026
@link2xt
link2xt deleted the link2xt/look-at-key-flags branch October 7, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delta Chat encrypts to subkey that is not marked with encryption flag

2 participants