Skip to content

Fix symmetric v6 message encryption - #1931

Closed
vanitasvitae wants to merge 2 commits into
bcgit:mainfrom
pgpainless:fixV6SKESKMessageEncryption
Closed

Fix symmetric v6 message encryption#1931
vanitasvitae wants to merge 2 commits into
bcgit:mainfrom
pgpainless:fixV6SKESKMessageEncryption

Conversation

@vanitasvitae

Copy link
Copy Markdown
Contributor

Commits 7d95b08 and ea31631 introduced an error where the plain session key was passed in the wrong format causing the session-key wrapper to fail due to an invalid block size.

Commits 7d95b08 and ea31631
introduced an error where the plain session key was passed in the wrong format
causing the session-key wrapper to fail due to an invalid block size.
@ligefeiBouncycastle

Copy link
Copy Markdown
Collaborator
  • As stated in RFC 9580, Section 3.7.2.1, Table 2, the Encryption column for 253 (AEAD) specifies the format as AEAD(HKDF(S2K(passphrase), info), secrets, packetprefix). The session key without checksum as part of its structure.
  • The sessionInfo is a constructed representation where a 1-byte algorithm identifier is prepended to the sessionKey, followed by a 2-byte checksum. In the original implementation of PBEKeyEncryptionMethodGenerator.generateV6ESK, there was a step to strip these additional 3 bytes from sessionInfo before usage.
    To optimize the process and align with the documentation, the decision was made to use the sessionKey directly for version 6 packages (v6 package), bypassing the intermediate sessionInfo structure.

@vanitasvitae

Copy link
Copy Markdown
Contributor Author

Hm, apparently I forgot to implement PKESKv6 generation completely :D
I'll work on a fix.

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.

2 participants