mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 02:39:39 +02:00
SOP encrypt --profile=rfc9580: Only override enc mechanism with seipd2 if exclusively symmetric encryption is used
This commit is contained in:
parent
f6806d05da
commit
8a161255ca
2 changed files with 6 additions and 1 deletions
|
@ -9,6 +9,7 @@ import org.bouncycastle.openpgp.PGPPublicKeyRing
|
|||
import org.bouncycastle.openpgp.api.MessageEncryptionMechanism
|
||||
import org.bouncycastle.openpgp.api.OpenPGPCertificate
|
||||
import org.bouncycastle.openpgp.api.OpenPGPCertificate.OpenPGPComponentKey
|
||||
import org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator
|
||||
import org.bouncycastle.openpgp.operator.PGPKeyEncryptionMethodGenerator
|
||||
import org.pgpainless.PGPainless
|
||||
import org.pgpainless.algorithm.EncryptionPurpose
|
||||
|
@ -427,6 +428,9 @@ class EncryptionOptions(private val purpose: EncryptionPurpose, private val api:
|
|||
|
||||
fun hasEncryptionMethod() = _encryptionMethods.isNotEmpty()
|
||||
|
||||
fun usesOnlyPasswordBasedEncryption() =
|
||||
_encryptionMethods.all { it is PBEKeyEncryptionMethodGenerator }
|
||||
|
||||
internal fun negotiateEncryptionMechanism(): MessageEncryptionMechanism {
|
||||
if (encryptionMechanismOverride != null) {
|
||||
return encryptionMechanismOverride!!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue