Class CachingBcPublicKeyDataDecryptorFactory
java.lang.Object
org.bouncycastle.openpgp.operator.AbstractPublicKeyDataDecryptorFactory
org.pgpainless.decryption_verification.CustomPublicKeyDataDecryptorFactory
org.pgpainless.decryption_verification.CachingBcPublicKeyDataDecryptorFactory
- All Implemented Interfaces:
org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory,org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory
Implementation of the
PublicKeyDataDecryptorFactory which caches decrypted session keys.
That way, if a message needs to be decrypted multiple times, expensive private key operations can be omitted.
This implementation changes the behavior or AbstractPublicKeyDataDecryptorFactory.recoverSessionData(int, byte[][]) to first return any
cache hits.
If no hit is found, the method call is delegated to the underlying PublicKeyDataDecryptorFactory.
The result of that is then placed in the cache and returned.-
Constructor Summary
ConstructorsConstructorDescriptionCachingBcPublicKeyDataDecryptorFactory(org.bouncycastle.openpgp.PGPPrivateKey privateKey, SubkeyIdentifier decryptionKey) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()byte[]costlyRecoverSessionData(int keyAlgorithm, byte[][] secKeyData, int pkeskVersion) org.bouncycastle.openpgp.operator.PGPDataDecryptorcreateDataDecryptor(boolean b, int i, byte[] bytes) org.bouncycastle.openpgp.operator.PGPDataDecryptorcreateDataDecryptor(org.bouncycastle.bcpg.AEADEncDataPacket aeadEncDataPacket, org.bouncycastle.openpgp.PGPSessionKey pgpSessionKey) org.bouncycastle.openpgp.operator.PGPDataDecryptorcreateDataDecryptor(org.bouncycastle.bcpg.SymmetricEncIntegrityPacket symmetricEncIntegrityPacket, org.bouncycastle.openpgp.PGPSessionKey pgpSessionKey) byte[]recoverSessionData(int keyAlgorithm, byte[][] secKeyData, int pkeskVersion) Methods inherited from class org.bouncycastle.openpgp.operator.AbstractPublicKeyDataDecryptorFactory
checkRange, containsSKAlg, prependSKAlgorithmToSessionData, recoverSessionData, recoverSessionData
-
Constructor Details
-
CachingBcPublicKeyDataDecryptorFactory
public CachingBcPublicKeyDataDecryptorFactory(org.bouncycastle.openpgp.PGPPrivateKey privateKey, SubkeyIdentifier decryptionKey)
-
-
Method Details
-
recoverSessionData
public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData, int pkeskVersion) throws org.bouncycastle.openpgp.PGPException - Throws:
org.bouncycastle.openpgp.PGPException
-
costlyRecoverSessionData
public byte[] costlyRecoverSessionData(int keyAlgorithm, byte[][] secKeyData, int pkeskVersion) throws org.bouncycastle.openpgp.PGPException - Throws:
org.bouncycastle.openpgp.PGPException
-
clear
public void clear() -
getSubkeyIdentifier
-
createDataDecryptor
public org.bouncycastle.openpgp.operator.PGPDataDecryptor createDataDecryptor(boolean b, int i, byte[] bytes) throws org.bouncycastle.openpgp.PGPException - Throws:
org.bouncycastle.openpgp.PGPException
-
createDataDecryptor
public org.bouncycastle.openpgp.operator.PGPDataDecryptor createDataDecryptor(org.bouncycastle.bcpg.AEADEncDataPacket aeadEncDataPacket, org.bouncycastle.openpgp.PGPSessionKey pgpSessionKey) throws org.bouncycastle.openpgp.PGPException - Throws:
org.bouncycastle.openpgp.PGPException
-
createDataDecryptor
public org.bouncycastle.openpgp.operator.PGPDataDecryptor createDataDecryptor(org.bouncycastle.bcpg.SymmetricEncIntegrityPacket symmetricEncIntegrityPacket, org.bouncycastle.openpgp.PGPSessionKey pgpSessionKey) throws org.bouncycastle.openpgp.PGPException - Throws:
org.bouncycastle.openpgp.PGPException
-