@@ -15,7 +15,8 @@ public abstract class PublicKeyKeyEncryptionMethodGenerator
1515 extends PGPKeyEncryptionMethodGenerator
1616{
1717 public static final String SESSION_KEY_OBFUSCATION_PROPERTY = "org.bouncycastle.openpgp.session_key_obfuscation" ;
18- public static final long WILDCARD = 0L ;
18+ public static final long WILDCARD_KEYID = 0L ;
19+ public static final byte [] WILDCARD_FINGERPRINT = new byte [0 ];
1920
2021 private static boolean getSessionKeyObfuscationDefault ()
2122 {
@@ -26,7 +27,7 @@ private static boolean getSessionKeyObfuscationDefault()
2627 private PGPPublicKey pubKey ;
2728
2829 protected boolean sessionKeyObfuscation ;
29- protected boolean useWildcardKeyID ;
30+ protected boolean useWildcardRecipient ;
3031
3132 protected PublicKeyKeyEncryptionMethodGenerator (
3233 PGPPublicKey pubKey )
@@ -62,7 +63,8 @@ protected PublicKeyKeyEncryptionMethodGenerator(
6263 /**
6364 * Controls whether to obfuscate the size of ECDH session keys using extra padding where necessary.
6465 * <p>
65- * The default behaviour can be configured using the system property "", or else it will default to enabled.
66+ * The default behaviour can be configured using the system property
67+ * "org.bouncycastle.openpgp.session_key_obfuscation", or else it will default to enabled.
6668 * </p>
6769 *
6870 * @return the current generator.
@@ -75,15 +77,28 @@ public PublicKeyKeyEncryptionMethodGenerator setSessionKeyObfuscation(boolean en
7577 }
7678
7779 /**
78- * Controls whether the recipient key ID is hidden (replaced by a wildcard ID <pre>0</pre> ).
80+ * Controls whether the recipient key ID/fingerprint is hidden (replaced by a wildcard value ).
7981 *
8082 * @param enabled boolean
8183 * @return this
84+ * @deprecated use {@link #setUseWildcardRecipient(boolean)} instead
85+ * TODO: Remove in a future release
8286 */
87+ @ Deprecated
8388 public PublicKeyKeyEncryptionMethodGenerator setUseWildcardKeyID (boolean enabled )
8489 {
85- this .useWildcardKeyID = enabled ;
90+ return setUseWildcardRecipient (enabled );
91+ }
8692
93+ /**
94+ * Controls whether the recipient key ID/fingerprint is hidden (replaced by a wildcard value).
95+ *
96+ * @param enabled boolean
97+ * @return this
98+ */
99+ public PublicKeyKeyEncryptionMethodGenerator setUseWildcardRecipient (boolean enabled )
100+ {
101+ this .useWildcardRecipient = enabled ;
87102 return this ;
88103 }
89104
@@ -144,9 +159,9 @@ public ContainedPacket generate(int encAlgorithm, byte[] sessionInfo)
144159 throws PGPException
145160 {
146161 long keyId ;
147- if (useWildcardKeyID )
162+ if (useWildcardRecipient )
148163 {
149- keyId = WILDCARD ;
164+ keyId = WILDCARD_KEYID ;
150165 }
151166 else
152167 {
0 commit comments