From f6806d05da0bbac22a3c72f73580b73620c5a6d3 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Tue, 3 Jun 2025 11:49:59 +0200 Subject: [PATCH] EncryptionMechanismNegotiator: Allow producing AEADED/OED packets --- .../negotiation/EncryptionMechanismNegotiator.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/algorithm/negotiation/EncryptionMechanismNegotiator.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/algorithm/negotiation/EncryptionMechanismNegotiator.kt index c8476910..238e3212 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/algorithm/negotiation/EncryptionMechanismNegotiator.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/algorithm/negotiation/EncryptionMechanismNegotiator.kt @@ -67,6 +67,15 @@ fun interface EncryptionMechanismNegotiator { return MessageEncryptionMechanism.aead( bestSupportedMode.ciphermode.algorithmId, bestSupportedMode.aeadAlgorithm.algorithmId) + } else if (features.all { it.contains(Feature.LIBREPGP_OCB_ENCRYPTED_DATA) }) { + return MessageEncryptionMechanism.librePgp( + symmetricKeyAlgorithmNegotiator + .negotiate( + policy.messageEncryptionAlgorithmPolicy + .symmetricAlgorithmPolicy, + null, + symmetricAlgorithmPreferences) + .algorithmId) } // If all support SEIPD1, negotiate SEIPD1 using symmetricKeyAlgorithmNegotiator else if (features.all { it.contains(Feature.MODIFICATION_DETECTION) }) {