@@ -78,28 +78,28 @@ public PGPSecretKey(
7878 * @param privKey the private key component.
7979 * @param pubKey the public key component.
8080 * @param checksumCalculator a calculator for the private key checksum
81- * @param isMasterKey true if the key is a master key, false otherwise.
81+ * @param isPrimaryKey true if the key is a primary key, false otherwise.
8282 * @param keyEncryptor an encryptor for the key if required (null otherwise).
8383 * @throws PGPException if there is an issue creating the secret key packet.
8484 */
8585 public PGPSecretKey (
8686 PGPPrivateKey privKey ,
8787 PGPPublicKey pubKey ,
8888 PGPDigestCalculator checksumCalculator ,
89- boolean isMasterKey ,
89+ boolean isPrimaryKey ,
9090 PBESecretKeyEncryptor keyEncryptor )
9191 throws PGPException
9292 {
93- this .pub = buildPublicKey (isMasterKey , pubKey );
94- this .secret = buildSecretKeyPacket (isMasterKey , privKey , pubKey , keyEncryptor , checksumCalculator );
93+ this .pub = buildPublicKey (isPrimaryKey , pubKey );
94+ this .secret = buildSecretKeyPacket (isPrimaryKey , privKey , pubKey , keyEncryptor , checksumCalculator );
9595 }
9696
97- private static PGPPublicKey buildPublicKey (boolean isMasterKey , PGPPublicKey pubKey )
97+ private static PGPPublicKey buildPublicKey (boolean isPrimaryKey , PGPPublicKey pubKey )
9898 {
9999 PublicKeyPacket pubPacket = pubKey .publicPk ;
100100
101101 // make sure we can actually do what's wanted
102- if (isMasterKey && !(pubKey .isEncryptionKey () && pubPacket .getAlgorithm () != PublicKeyAlgorithmTags .RSA_GENERAL ))
102+ if (isPrimaryKey && !(pubKey .isEncryptionKey () && pubPacket .getAlgorithm () != PublicKeyAlgorithmTags .RSA_GENERAL ))
103103 {
104104 PGPPublicKey mstKey = new PGPPublicKey (pubKey );
105105 mstKey .publicPk = new PublicKeyPacket (pubPacket .getVersion (), pubPacket .getAlgorithm (), pubPacket .getTime (), pubPacket .getKey ());
@@ -113,14 +113,14 @@ private static PGPPublicKey buildPublicKey(boolean isMasterKey, PGPPublicKey pub
113113 }
114114 }
115115
116- private static SecretKeyPacket buildSecretKeyPacket (boolean isMasterKey , PGPPrivateKey privKey , PGPPublicKey pubKey , PBESecretKeyEncryptor keyEncryptor , PGPDigestCalculator checksumCalculator )
116+ private static SecretKeyPacket buildSecretKeyPacket (boolean isPrimaryKey , PGPPrivateKey privKey , PGPPublicKey pubKey , PBESecretKeyEncryptor keyEncryptor , PGPDigestCalculator checksumCalculator )
117117 throws PGPException
118118 {
119119 BCPGObject secKey = (BCPGObject )privKey .getPrivateKeyDataPacket ();
120120
121121 if (secKey == null )
122122 {
123- return generateSecretKeyPacket (isMasterKey , pubKey .publicPk , SymmetricKeyAlgorithmTags .NULL , new byte [0 ]);
123+ return generateSecretKeyPacket (isPrimaryKey , pubKey .publicPk , SymmetricKeyAlgorithmTags .NULL , new byte [0 ]);
124124 }
125125
126126 try
@@ -149,7 +149,7 @@ private static SecretKeyPacket buildSecretKeyPacket(boolean isMasterKey, PGPPriv
149149 if (keyEncryptor .getAeadAlgorithm () != 0 )
150150 {
151151 s2kUsage = SecretKeyPacket .USAGE_AEAD ;
152- return generateSecretKeyPacket (isMasterKey , pubKey .publicPk , encAlgorithm , keyEncryptor .getAeadAlgorithm (), s2kUsage , s2k , iv , encData );
152+ return generateSecretKeyPacket (isPrimaryKey , pubKey .publicPk , encAlgorithm , keyEncryptor .getAeadAlgorithm (), s2kUsage , s2k , iv , encData );
153153 }
154154
155155 if (checksumCalculator != null )
@@ -165,13 +165,13 @@ private static SecretKeyPacket buildSecretKeyPacket(boolean isMasterKey, PGPPriv
165165 s2kUsage = SecretKeyPacket .USAGE_CHECKSUM ;
166166 }
167167
168- return generateSecretKeyPacket (isMasterKey , pubKey .publicPk , encAlgorithm , s2kUsage , s2k , iv , encData );
168+ return generateSecretKeyPacket (isPrimaryKey , pubKey .publicPk , encAlgorithm , s2kUsage , s2k , iv , encData );
169169 }
170170 else if (pubKey .getVersion () != PublicKeyPacket .VERSION_6 )
171171 {
172172 pOut .write (checksum (null , keyData , keyData .length ));
173173 }
174- return generateSecretKeyPacket (isMasterKey , pubKey .publicPk , encAlgorithm , bOut .toByteArray ());
174+ return generateSecretKeyPacket (isPrimaryKey , pubKey .publicPk , encAlgorithm , bOut .toByteArray ());
175175 }
176176 catch (PGPException e )
177177 {
@@ -183,9 +183,9 @@ else if (pubKey.getVersion() != PublicKeyPacket.VERSION_6)
183183 }
184184 }
185185
186- private static SecretKeyPacket generateSecretKeyPacket (boolean isMasterKey , PublicKeyPacket pubKey , int encAlgorithm , byte [] secKeyData )
186+ private static SecretKeyPacket generateSecretKeyPacket (boolean isPrimaryKey , PublicKeyPacket pubKey , int encAlgorithm , byte [] secKeyData )
187187 {
188- if (isMasterKey )
188+ if (isPrimaryKey )
189189 {
190190 return new SecretKeyPacket (pubKey , encAlgorithm , null , null , secKeyData );
191191 }
@@ -195,9 +195,9 @@ private static SecretKeyPacket generateSecretKeyPacket(boolean isMasterKey, Publ
195195 }
196196 }
197197
198- private static SecretKeyPacket generateSecretKeyPacket (boolean isMasterKey , PublicKeyPacket pubKey , int encAlgorithm , int s2kusage , S2K s2k , byte [] iv , byte [] secKeyData )
198+ private static SecretKeyPacket generateSecretKeyPacket (boolean isPrimaryKey , PublicKeyPacket pubKey , int encAlgorithm , int s2kusage , S2K s2k , byte [] iv , byte [] secKeyData )
199199 {
200- if (isMasterKey )
200+ if (isPrimaryKey )
201201 {
202202 return new SecretKeyPacket (pubKey , encAlgorithm , s2kusage , s2k , iv , secKeyData );
203203 }
@@ -207,9 +207,9 @@ private static SecretKeyPacket generateSecretKeyPacket(boolean isMasterKey, Publ
207207 }
208208 }
209209
210- private static SecretKeyPacket generateSecretKeyPacket (boolean isMasterKey , PublicKeyPacket pubKey , int encAlgorithm , int aeadAlgorithm , int s2kUsage , S2K s2K , byte [] iv , byte [] secKeyData )
210+ private static SecretKeyPacket generateSecretKeyPacket (boolean isPrimaryKey , PublicKeyPacket pubKey , int encAlgorithm , int aeadAlgorithm , int s2kUsage , S2K s2K , byte [] iv , byte [] secKeyData )
211211 {
212- if (isMasterKey )
212+ if (isPrimaryKey )
213213 {
214214 return new SecretKeyPacket (pubKey , encAlgorithm , aeadAlgorithm , s2kUsage , s2K , iv , secKeyData );
215215 }
@@ -250,32 +250,32 @@ public PGPSecretKey(
250250 }
251251
252252 /**
253- * Construct a PGPSecretKey sub-key using the passed in private/public key pair and binding it to the master key pair.
253+ * Construct a PGPSecretKey sub-key using the passed in private/public key pair and binding it to the primary key pair.
254254 * The secret key checksum is calculated using the passed in checksum calculator.
255255 *
256- * @param masterKeyPair the master public/private keys for the new subkey.
256+ * @param primaryKeyPair the primary public/private keys for the new subkey.
257257 * @param keyPair the public/private keys to use.
258258 * @param checksumCalculator a calculator for the private key checksum
259259 * @param certificationSignerBuilder the builder for generating the certification.
260260 * @param keyEncryptor an encryptor for the key if required (null otherwise).
261261 * @throws PGPException if there is an issue creating the secret key packet or the certification.
262262 */
263263 public PGPSecretKey (
264- PGPKeyPair masterKeyPair ,
264+ PGPKeyPair primaryKeyPair ,
265265 PGPKeyPair keyPair ,
266266 PGPDigestCalculator checksumCalculator ,
267267 PGPContentSignerBuilder certificationSignerBuilder ,
268268 PBESecretKeyEncryptor keyEncryptor )
269269 throws PGPException
270270 {
271- this (masterKeyPair , keyPair , checksumCalculator , null , null , certificationSignerBuilder , keyEncryptor );
271+ this (primaryKeyPair , keyPair , checksumCalculator , null , null , certificationSignerBuilder , keyEncryptor );
272272 }
273273
274274 /**
275- * Construct a PGPSecretKey sub-key using the passed in private/public key pair and binding it to the master key pair.
275+ * Construct a PGPSecretKey sub-key using the passed in private/public key pair and binding it to the primary key pair.
276276 * The secret key checksum is calculated using the passed in checksum calculator.
277277 *
278- * @param masterKeyPair the master public/private keys for the new subkey.
278+ * @param primaryKeyPair the primary public/private keys for the new subkey.
279279 * @param keyPair the public/private keys to use.
280280 * @param checksumCalculator calculator for PGP key checksums.
281281 * @param hashedPcks the hashed packets to be added to the certification.
@@ -285,7 +285,7 @@ public PGPSecretKey(
285285 * @throws PGPException if there is an issue creating the secret key packet or the certification.
286286 */
287287 public PGPSecretKey (
288- PGPKeyPair masterKeyPair ,
288+ PGPKeyPair primaryKeyPair ,
289289 PGPKeyPair keyPair ,
290290 PGPDigestCalculator checksumCalculator ,
291291 PGPSignatureSubpacketVector hashedPcks ,
@@ -297,9 +297,9 @@ public PGPSecretKey(
297297 //
298298 // generate the certification
299299 //
300- PGPSignatureGenerator sGen = new PGPSignatureGenerator (certificationSignerBuilder , masterKeyPair .getPublicKey ());
300+ PGPSignatureGenerator sGen = new PGPSignatureGenerator (certificationSignerBuilder , primaryKeyPair .getPublicKey ());
301301
302- sGen .init (PGPSignature .SUBKEY_BINDING , masterKeyPair .getPrivateKey ());
302+ sGen .init (PGPSignature .SUBKEY_BINDING , primaryKeyPair .getPrivateKey ());
303303
304304 // do some basic checking if we are a signing key.
305305 if (!keyPair .getPublicKey ().isEncryptionKey ())
@@ -314,7 +314,7 @@ public PGPSecretKey(
314314
315315 try
316316 {
317- subGen .addEmbeddedSignature (false , signatureGenerator .generateCertification (masterKeyPair .getPublicKey (), keyPair .getPublicKey ()));
317+ subGen .addEmbeddedSignature (false , signatureGenerator .generateCertification (primaryKeyPair .getPublicKey (), keyPair .getPublicKey ()));
318318
319319 hashedPcks = subGen .generate ();
320320 }
@@ -334,7 +334,7 @@ else if (!hashedPcks.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE))
334334
335335 List <PGPSignature > subSigs = new ArrayList <PGPSignature >();
336336
337- subSigs .add (sGen .generateCertification (masterKeyPair .getPublicKey (), keyPair .getPublicKey ()));
337+ subSigs .add (sGen .generateCertification (primaryKeyPair .getPublicKey (), keyPair .getPublicKey ()));
338338
339339 // replace the public key packet structure with a public subkey one.
340340 PGPPublicKey pubSubKey = new PGPPublicKey (keyPair .getPublicKey (), null , subSigs );
@@ -353,7 +353,7 @@ else if (!hashedPcks.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE))
353353 * key in order for it to be considered valid.
354354 *
355355 * @param certificationLevel the type of certification to be added.
356- * @param keyPair the public/private keys to use.
356+ * @param keyPair the primary public/private keys to use.
357357 * @param id the id to bind to the key.
358358 * @param checksumCalculator a calculator for the private key checksum.
359359 * @param hashedPcks the hashed packets to be added to the certification.
@@ -430,9 +430,9 @@ public boolean isSigningKey()
430430 }
431431
432432 /**
433- * Return true if this is a master key.
433+ * Return true if this is a primary key.
434434 *
435- * @return true if a master key.
435+ * @return true if a primary key.
436436 */
437437 public boolean isMasterKey ()
438438 {
@@ -442,7 +442,7 @@ public boolean isMasterKey()
442442 /**
443443 * Detect if the Secret Key's Private Key is empty or not
444444 *
445- * @return boolean whether or not the private key is empty
445+ * @return boolean whether the private key is empty
446446 */
447447 public boolean isPrivateKeyEmpty ()
448448 {
0 commit comments