[v6] Add config.parseAEADEncryptedV4KeysAsLegacy
to support AEAD-encrypted v4 keys from OpenPGP.js v5 or older
#1672
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds the config flag
parseAEADEncryptedV4KeysAsLegacy
.When reading private keys which were encrypted by OpenPGP.js v5 (or older) using
config.aeadProtect = true
andconfig.v5Keys = false
, this option must be set, otherwise key parsing and/or key decryption will fail.OpenPGP.js up to v5 used to support encrypting v4 keys using AEAD as specified by draft RFC4880bis (https://www.ietf.org/archive/id/draft-ietf-openpgp-rfc4880bis-10.html#section-5.5.3-3.5).
The config option to do so was not initially marked as "experimental", so there is a risk that some apps have been using it in production.
This legacy format is incompatible, but fundamentally indistinguishable, from that of the crypto-refresh for v4 keys, merged in #1630 . If a key is parsed based on the wrong format, the parsing may still succeed, but key decryption will always fail.
Thus, we rely on the caller to instruct us to process the key as legacy, via the new config flag.