1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-09 10:19:39 +02:00

setPreferredAEADCiphersuites(): Add missing method taking PreferredAEADCiphersuites object

This commit is contained in:
Paul Schaub 2025-06-16 11:12:08 +02:00
parent 1106cb4228
commit 319847d4a8
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 17 additions and 3 deletions

View file

@ -121,6 +121,10 @@ interface SelfSignatureSubpackets : BaseSignatureSubpackets {
algorithms: PreferredAEADCiphersuites.Builder?
): SelfSignatureSubpackets
fun setPreferredAEADCiphersuites(
preferredAEADCiphersuites: PreferredAEADCiphersuites?
): SelfSignatureSubpackets
@Deprecated("Use of this subpacket is discouraged.")
fun addRevocationKey(revocationKey: PGPPublicKey): SelfSignatureSubpackets

View file

@ -281,9 +281,15 @@ class SignatureSubpackets(
override fun setPreferredAEADCiphersuites(
algorithms: PreferredAEADCiphersuites.Builder?
): SignatureSubpackets = apply {
): SignatureSubpackets = setPreferredAEADCiphersuites(algorithms?.build())
override fun setPreferredAEADCiphersuites(
preferredAEADCiphersuites: PreferredAEADCiphersuites?
) = apply {
subpacketsGenerator.removePacketsOfType(SignatureSubpacketTags.PREFERRED_AEAD_ALGORITHMS)
algorithms?.let { subpacketsGenerator.setPreferredAEADCiphersuites(algorithms) }
preferredAEADCiphersuites?.let {
subpacketsGenerator.setPreferredAEADCiphersuites(it.isCritical, it.rawAlgorithms)
}
}
override fun addRevocationKey(revocationKey: PGPPublicKey): SignatureSubpackets = apply {

View file

@ -61,6 +61,11 @@ class SignatureSubpacketsHelper {
PreferredAlgorithms(
it.type, it.isCritical, it.isLongLength, it.data))
}
SignatureSubpacket.preferredAEADAlgorithms ->
(subpacket as PreferredAEADCiphersuites).let {
subpackets.setPreferredAEADCiphersuites(
PreferredAEADCiphersuites(it.isCritical, it.rawAlgorithms))
}
SignatureSubpacket.revocationKey ->
(subpacket as RevocationKey).let {
subpackets.addRevocationKey(
@ -130,7 +135,6 @@ class SignatureSubpacketsHelper {
SignatureSubpacket.keyServerPreferences,
SignatureSubpacket.preferredKeyServers,
SignatureSubpacket.placeholder,
SignatureSubpacket.preferredAEADAlgorithms,
SignatureSubpacket.attestedCertification ->
subpackets.addResidualSubpacket(subpacket)
else -> subpackets.addResidualSubpacket(subpacket)