Skip to content

Commit fd19596

Browse files
author
gefeili
committed
Add back PublicKeyDataDecryptorFactory.recoverSessionData(int keyAlgorithm, byte[][] secKeyData) function
1 parent f38ed30 commit fd19596

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ public final byte[] recoverSessionData(PublicKeyEncSessionPacket pkesk, InputStr
2121
return prependSKAlgorithmToSessionData(pkesk, encData, sessionData);
2222
}
2323

24+
@Override
25+
public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData)
26+
throws PGPException
27+
{
28+
return recoverSessionData(keyAlgorithm, secKeyData, PublicKeyEncSessionPacket.VERSION_3);
29+
}
2430

2531
protected byte[] prependSKAlgorithmToSessionData(PublicKeyEncSessionPacket pkesk,
2632
InputStreamPacket encData,

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

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ public interface PublicKeyDataDecryptorFactory
2020
byte[] recoverSessionData(PublicKeyEncSessionPacket pkesk, InputStreamPacket encData)
2121
throws PGPException;
2222

23+
/**
24+
* Recover the plain session info by decrypting the encrypted session key.
25+
* This method returns the decrypted session info as-is (without prefixing missing cipher algorithm),
26+
* so the return value is:
27+
* <pre>[sym-alg]?[session-key][checksum]?</pre>
28+
*
29+
* @deprecated use {@link #recoverSessionData(PublicKeyEncSessionPacket, InputStreamPacket)} instead.
30+
* @param keyAlgorithm public key algorithm
31+
* @param secKeyData encrypted session key data
32+
* @return decrypted session info
33+
* @throws PGPException
34+
*/
35+
byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData)
36+
throws PGPException;
37+
2338
/**
2439
* Recover the plain session info by decrypting the encrypted session key.
2540
* This method returns the decrypted session info as-is (without prefixing missing cipher algorithm),

0 commit comments

Comments
 (0)