File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
main/java/org/bouncycastle/openpgp
test/java/org/bouncycastle/openpgp/test Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -134,11 +134,13 @@ public PGPEncryptedDataList(
134134 * session key.
135135 *
136136 * @param sessionKey session key for message decryption
137+ * @return session key encrypted data
137138 */
138- public void addSessionKeyDecryptionMethod (PGPSessionKey sessionKey )
139+ public PGPSessionKeyEncryptedData addSessionKeyDecryptionMethod (PGPSessionKey sessionKey )
139140 {
140141 PGPSessionKeyEncryptedData sessionKeyEncryptedData = new PGPSessionKeyEncryptedData (sessionKey , data );
141142 methods .add (sessionKeyEncryptedData );
143+ return sessionKeyEncryptedData ;
142144 }
143145
144146 /**
Original file line number Diff line number Diff line change @@ -291,11 +291,11 @@ private void decryptMessageWithoutEskUsingSessionKey()
291291 PGPEncryptedDataList encryptedData = (PGPEncryptedDataList ) objectFactory .nextObject ();
292292 isEquals (0 , encryptedData .size ()); // there is no encrypted session key packet
293293
294- encryptedData .addSessionKeyDecryptionMethod (sessionKey ); // Add decryption method using a session key
294+ // Add decryption method using a session key
295+ PGPSessionKeyEncryptedData sessionKeyEncData = encryptedData .addSessionKeyDecryptionMethod (sessionKey );
295296 isEquals (1 , encryptedData .size ());
296297
297298 SessionKeyDataDecryptorFactory decryptorFactory = new BcSessionKeyDataDecryptorFactory (sessionKey );
298- PGPSessionKeyEncryptedData sessionKeyEncData = (PGPSessionKeyEncryptedData ) encryptedData .get (0 );
299299 InputStream decrypted = sessionKeyEncData .getDataStream (decryptorFactory );
300300
301301 objectFactory = new BcPGPObjectFactory (decrypted );
You can’t perform that action at this time.
0 commit comments