Skip to content

Commit

Permalink
Properly parse and set PreferredAEADCipherSuites subpacket
Browse files Browse the repository at this point in the history
  • Loading branch information
vanitasvitae committed Aug 1, 2023
1 parent 91c3c60 commit 011edd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.bouncycastle.bcpg.sig.KeyFlags;
import org.bouncycastle.bcpg.sig.NotationData;
import org.bouncycastle.bcpg.sig.PolicyURI;
import org.bouncycastle.bcpg.sig.PreferredAEADCiphersuites;
import org.bouncycastle.bcpg.sig.PreferredAlgorithms;
import org.bouncycastle.bcpg.sig.PrimaryUserID;
import org.bouncycastle.bcpg.sig.Revocable;
Expand Down Expand Up @@ -187,10 +188,9 @@ public void setPreferredCompressionAlgorithms(boolean isCritical, int[] algorith
* @param isCritical true if should be treated as critical, false otherwise.
* @param algorithms array of algorithms in descending preference
*/
public void setPreferredAEADAlgorithms(boolean isCritical, int[] algorithms)
public void setPreferredAEADAlgorithms(boolean isCritical, PreferredAEADCiphersuites.Combination[] algorithms)
{
packets.add(new PreferredAlgorithms(SignatureSubpacketTags.PREFERRED_AEAD_ALGORITHMS, isCritical,
algorithms));
packets.add(new PreferredAEADCiphersuites(isCritical, algorithms));
}

public void addPolicyURI(boolean isCritical, String policyUri)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.bouncycastle.bcpg.sig.KeyFlags;
import org.bouncycastle.bcpg.sig.NotationData;
import org.bouncycastle.bcpg.sig.PolicyURI;
import org.bouncycastle.bcpg.sig.PreferredAEADCiphersuites;
import org.bouncycastle.bcpg.sig.PreferredAlgorithms;
import org.bouncycastle.bcpg.sig.PrimaryUserID;
import org.bouncycastle.bcpg.sig.RegularExpression;
Expand Down Expand Up @@ -257,7 +258,7 @@ public int[] getPreferredCompressionAlgorithms()
return ((PreferredAlgorithms)p).getPreferences();
}

public int[] getPreferredAEADAlgorithms()
public PreferredAEADCiphersuites.Combination[] getPreferredAEADAlgorithms()
{
SignatureSubpacket p = this.getSubpacket(SignatureSubpacketTags.PREFERRED_AEAD_ALGORITHMS);

Expand All @@ -266,7 +267,7 @@ public int[] getPreferredAEADAlgorithms()
return null;
}

return ((PreferredAlgorithms)p).getPreferences();
return ((PreferredAEADCiphersuites)p).getAlgorithms();
}

public int getKeyFlags()
Expand Down

0 comments on commit 011edd0

Please sign in to comment.