|
15 | 15 | import org.bouncycastle.bcpg.sig.IssuerKeyID;
|
16 | 16 | import org.bouncycastle.bcpg.sig.KeyExpirationTime;
|
17 | 17 | import org.bouncycastle.bcpg.sig.KeyFlags;
|
| 18 | +import org.bouncycastle.bcpg.sig.LibrePGPPreferredEncryptionModes; |
18 | 19 | import org.bouncycastle.bcpg.sig.NotationData;
|
19 | 20 | import org.bouncycastle.bcpg.sig.PolicyURI;
|
| 21 | +import org.bouncycastle.bcpg.sig.PreferredAEADCiphersuites; |
20 | 22 | import org.bouncycastle.bcpg.sig.PreferredAlgorithms;
|
21 | 23 | import org.bouncycastle.bcpg.sig.PrimaryUserID;
|
22 | 24 | import org.bouncycastle.bcpg.sig.RegularExpression;
|
@@ -191,17 +193,69 @@ public void setPreferredCompressionAlgorithms(boolean isCritical, int[] algorith
|
191 | 193 | }
|
192 | 194 |
|
193 | 195 | /**
|
| 196 | + * This method is BROKEN! |
194 | 197 | * Specify the preferred AEAD algorithms of this key.
|
195 | 198 | *
|
196 | 199 | * @param isCritical true if should be treated as critical, false otherwise.
|
197 | 200 | * @param algorithms array of algorithms in descending preference
|
| 201 | + * @deprecated use {@link #setPreferredAEADCiphersuites(boolean, PreferredAEADCiphersuites.Combination[])} |
| 202 | + * or {@link #setPreferredLibrePgpEncryptionModes(boolean, int[])} instead. |
198 | 203 | */
|
| 204 | + @Deprecated |
199 | 205 | public void setPreferredAEADAlgorithms(boolean isCritical, int[] algorithms)
|
200 | 206 | {
|
201 | 207 | packets.add(new PreferredAlgorithms(SignatureSubpacketTags.PREFERRED_AEAD_ALGORITHMS, isCritical,
|
202 | 208 | algorithms));
|
203 | 209 | }
|
204 | 210 |
|
| 211 | + /** |
| 212 | + * Specify the preferred OpenPGP AEAD ciphersuites of this key. |
| 213 | + * |
| 214 | + * @see <a href="https://www.rfc-editor.org/rfc/rfc9580.html#name-preferred-aead-ciphersuites"> |
| 215 | + * RFC9580: Preferred AEAD Ciphersuites</a> |
| 216 | + * |
| 217 | + * @param isCritical true, if this packet should be treated as critical, false otherwise. |
| 218 | + * @param algorithms array of algorithms in descending preference |
| 219 | + */ |
| 220 | + public void setPreferredAEADCiphersuites(boolean isCritical, PreferredAEADCiphersuites.Combination[] algorithms) |
| 221 | + { |
| 222 | + packets.add(new PreferredAEADCiphersuites(isCritical, algorithms)); |
| 223 | + } |
| 224 | + |
| 225 | + /** |
| 226 | + * Specify the preferred OpenPGP AEAD ciphersuites of this key. |
| 227 | + * |
| 228 | + * @see <a href="https://www.rfc-editor.org/rfc/rfc9580.html#name-preferred-aead-ciphersuites"> |
| 229 | + * RFC9580: Preferred AEAD Ciphersuites</a> |
| 230 | + * |
| 231 | + * @param builder builder to build the ciphersuites packet from |
| 232 | + */ |
| 233 | + public void setPreferredAEADCiphersuites(PreferredAEADCiphersuites.Builder builder) |
| 234 | + { |
| 235 | + packets.add(builder.build()); |
| 236 | + } |
| 237 | + |
| 238 | + /** |
| 239 | + * Set the preferred encryption modes for LibrePGP keys. |
| 240 | + * Note: LibrePGP is not OpenPGP. An application strictly compliant to only the OpenPGP standard will not |
| 241 | + * know how to handle LibrePGP encryption modes. |
| 242 | + * The LibrePGP spec states that this subpacket shall be ignored and the application shall instead assume |
| 243 | + * {@link org.bouncycastle.bcpg.AEADAlgorithmTags#OCB}. |
| 244 | + * |
| 245 | + * @see <a href="https://www.ietf.org/archive/id/draft-koch-librepgp-01.html#name-preferred-encryption-modes"> |
| 246 | + * LibrePGP: Preferred Encryption Modes</a> |
| 247 | + * @see org.bouncycastle.bcpg.AEADAlgorithmTags for possible algorithms |
| 248 | + * |
| 249 | + * @param isCritical whether the packet is critical |
| 250 | + * @param algorithms list of algorithms |
| 251 | + * @deprecated the use of this subpacket is deprecated in LibrePGP |
| 252 | + */ |
| 253 | + @Deprecated |
| 254 | + public void setPreferredLibrePgpEncryptionModes(boolean isCritical, int[] algorithms) |
| 255 | + { |
| 256 | + packets.add(new LibrePGPPreferredEncryptionModes(isCritical, algorithms)); |
| 257 | + } |
| 258 | + |
205 | 259 | public void addPolicyURI(boolean isCritical, String policyUri)
|
206 | 260 | {
|
207 | 261 | packets.add(new PolicyURI(isCritical, policyUri));
|
|
0 commit comments