Skip to content

carddav: fix contact encryption key selection (user key vs address key)#10

Open
haurucknde wants to merge 1 commit into
acheong08:mainfrom
haurucknde:fix/carddav-user-key-encryption
Open

carddav: fix contact encryption key selection (user key vs address key)#10
haurucknde wants to merge 1 commit into
acheong08:mainfrom
haurucknde:fix/carddav-user-key-encryption

Conversation

@haurucknde

Copy link
Copy Markdown

Changes

Contact encryption key selection (user key vs address key)

Same root cause as emersion#157 and emersion#288:
Unlock() returned only address keys, but Proton's web UI decrypts contacts
with the user key (master account key). On modern Proton accounts these differ,
causing "decryption of encrypted content failed" for all contacts written via CardDAV.

Fix: Unlock() now includes user keys first in the key ring and tracks the primary
user key ID. CardDAV handler encrypts/signs with the user key.

Testing

  • CardDAV: PUT contacts with NOTE + CATEGORIES → open in Proton web UI, no decryption errors
  • CalDAV: verified still working after key ring change
  • IMAP/SMTP: all callers updated for new function signatures, verified compilation

Unlock() returned only address keys in the key ring. However, Proton's
web client encrypts and signs contacts using the user key (the master
account key), not the address key. On accounts where the user key and
address key differ — which is the case for all modern Proton accounts —
contacts written via CardDAV cannot be decrypted by the Proton client,
resulting in "The decryption of the encrypted content failed" errors.

Unlock() now includes user keys in the returned key ring (user keys
first, then address keys) and tracks the primary user key ID separately.
The CardDAV handler encrypts and signs contact data using the primary
user key, matching the behaviour of Proton's own clients.
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.

1 participant