1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-09 18:29: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 9a8ecb7fa0
commit 2270c69af7
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? algorithms: PreferredAEADCiphersuites.Builder?
): SelfSignatureSubpackets ): SelfSignatureSubpackets
fun setPreferredAEADCiphersuites(
preferredAEADCiphersuites: PreferredAEADCiphersuites?
): SelfSignatureSubpackets
@Deprecated("Use of this subpacket is discouraged.") @Deprecated("Use of this subpacket is discouraged.")
fun addRevocationKey(revocationKey: PGPPublicKey): SelfSignatureSubpackets fun addRevocationKey(revocationKey: PGPPublicKey): SelfSignatureSubpackets

View file

@ -281,9 +281,15 @@ class SignatureSubpackets(
override fun setPreferredAEADCiphersuites( override fun setPreferredAEADCiphersuites(
algorithms: PreferredAEADCiphersuites.Builder? algorithms: PreferredAEADCiphersuites.Builder?
): SignatureSubpackets = apply { ): SignatureSubpackets = setPreferredAEADCiphersuites(algorithms?.build())
override fun setPreferredAEADCiphersuites(
preferredAEADCiphersuites: PreferredAEADCiphersuites?
) = apply {
subpacketsGenerator.removePacketsOfType(SignatureSubpacketTags.PREFERRED_AEAD_ALGORITHMS) 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 { override fun addRevocationKey(revocationKey: PGPPublicKey): SignatureSubpackets = apply {

View file

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