|
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; |
@@ -202,6 +204,54 @@ public void setPreferredAEADAlgorithms(boolean isCritical, int[] algorithms) |
202 | 204 | algorithms)); |
203 | 205 | } |
204 | 206 |
|
| 207 | + /** |
| 208 | + * Specify the preferred OpenPGP AEAD ciphersuites of this key. |
| 209 | + * |
| 210 | + * @see <a href="https://www.rfc-editor.org/rfc/rfc9580.html#name-preferred-aead-ciphersuites"> |
| 211 | + * RFC9580: Preferred AEAD Ciphersuites</a> |
| 212 | + * |
| 213 | + * @param isCritical true, if this packet should be treated as critical, false otherwise. |
| 214 | + * @param algorithms array of algorithms in descending preference |
| 215 | + */ |
| 216 | + public void setPreferredAEADCiphersuites(boolean isCritical, PreferredAEADCiphersuites.Combination[] algorithms) |
| 217 | + { |
| 218 | + packets.add(new PreferredAEADCiphersuites(isCritical, algorithms)); |
| 219 | + } |
| 220 | + |
| 221 | + /** |
| 222 | + * Specify the preferred OpenPGP AEAD ciphersuites of this key. |
| 223 | + * |
| 224 | + * @see <a href="https://www.rfc-editor.org/rfc/rfc9580.html#name-preferred-aead-ciphersuites"> |
| 225 | + * RFC9580: Preferred AEAD Ciphersuites</a> |
| 226 | + * |
| 227 | + * @param builder builder to build the ciphersuites packet from |
| 228 | + */ |
| 229 | + public void setPreferredAEADCiphersuites(PreferredAEADCiphersuites.Builder builder) |
| 230 | + { |
| 231 | + packets.add(builder.build()); |
| 232 | + } |
| 233 | + |
| 234 | + /** |
| 235 | + * Set the preferred encryption modes for LibrePGP keys. |
| 236 | + * Note: LibrePGP is not OpenPGP. An application strictly compliant to only the OpenPGP standard will not |
| 237 | + * know how to handle LibrePGP encryption modes. |
| 238 | + * The LibrePGP spec states that this subpacket shall be ignored and the application shall instead assume |
| 239 | + * {@link org.bouncycastle.bcpg.AEADAlgorithmTags#OCB}. |
| 240 | + * |
| 241 | + * @see <a href="https://www.ietf.org/archive/id/draft-koch-librepgp-01.html#name-preferred-encryption-modes"> |
| 242 | + * LibrePGP: Preferred Encryption Modes</a> |
| 243 | + * @see org.bouncycastle.bcpg.AEADAlgorithmTags for possible algorithms |
| 244 | + * |
| 245 | + * @param isCritical whether the packet is critical |
| 246 | + * @param algorithms list of algorithms |
| 247 | + * @deprecated the use of this subpacket is deprecated in LibrePGP |
| 248 | + */ |
| 249 | + @Deprecated |
| 250 | + public void setPreferredLibrePgpEncryptionModes(boolean isCritical, int[] algorithms) |
| 251 | + { |
| 252 | + packets.add(new LibrePGPPreferredEncryptionModes(isCritical, algorithms)); |
| 253 | + } |
| 254 | + |
205 | 255 | public void addPolicyURI(boolean isCritical, String policyUri) |
206 | 256 | { |
207 | 257 | packets.add(new PolicyURI(isCritical, policyUri)); |
|
0 commit comments