Skip to content

Commit 1e73d11

Browse files
committed
Add javadoc
1 parent 11b7330 commit 1e73d11

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pg/src/main/java/org/bouncycastle/openpgp/operator/PublicKeyKeyEncryptionMethodGenerator.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,41 @@ public ContainedPacket generateV6(byte[] sessionInfo)
192192
return PublicKeyEncSessionPacket.createV6PKESKPacket(keyVersion, keyFingerprint, pubKey.getAlgorithm(), encodedEncSessionInfo);
193193
}
194194

195+
/**
196+
* Encrypt a session key using the recipients public key.
197+
* @param pubKey recipients public key
198+
* @param fullSessionInfo full session info (sym-alg-id + session-key + 2 octet checksum)
199+
* @param sessionInfoToEncrypt for v3: full session info; for v6: just the session-key
200+
* @param optSymAlgId for v3: session key algorithm ID; for v6: empty array
201+
* @return encrypted session info
202+
* @throws PGPException
203+
*/
195204
protected abstract byte[] encryptSessionInfo(PGPPublicKey pubKey,
196205
byte[] fullSessionInfo,
197206
byte[] sessionInfoToEncrypt,
198207
byte[] optSymAlgId)
199208
throws PGPException;
200209

210+
/**
211+
* Encrypt a session key for a v3 PKESK.
212+
* @param pubKey recipients public key
213+
* @param sessionInfo session info (sym-alg-id + session-key + 2 octet checksum)
214+
* @return encrypted session info
215+
* @throws PGPException
216+
*/
201217
protected byte[] encryptSessionInfoV3(PGPPublicKey pubKey, byte[] sessionInfo)
202218
throws PGPException
203219
{
204220
return encryptSessionInfo(pubKey, sessionInfo, sessionInfo, new byte[]{sessionInfo[0]});
205221
}
206222

223+
/**
224+
* Encrypt a session key for a v6 PKESK.
225+
* @param pubKey recipients public key
226+
* @param sessionInfo session info (sym-alg-id + session-key + 2 octet checksum)
227+
* @return encrypted session info
228+
* @throws PGPException
229+
*/
207230
protected byte[] encryptSessionInfoV6(PGPPublicKey pubKey, byte[] sessionInfo)
208231
throws PGPException
209232
{

0 commit comments

Comments
 (0)