Package org.bouncycastle
Class CachingBcPublicKeyDataDecryptorFactory
- java.lang.Object
-
- org.bouncycastle.openpgp.operator.bc.BcPublicKeyDataDecryptorFactory
-
- org.bouncycastle.CachingBcPublicKeyDataDecryptorFactory
-
- All Implemented Interfaces:
org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory,org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory,CustomPublicKeyDataDecryptorFactory
public class CachingBcPublicKeyDataDecryptorFactory extends org.bouncycastle.openpgp.operator.bc.BcPublicKeyDataDecryptorFactory implements CustomPublicKeyDataDecryptorFactory
Implementation of thePublicKeyDataDecryptorFactorywhich 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 orrecoverSessionData(int, byte[][])to first return any cache hits. If no hit is found, the method call is delegated to the underlyingPublicKeyDataDecryptorFactory. The result of that is then placed in the cache and returned.
-
-
Constructor Summary
Constructors Constructor Description CachingBcPublicKeyDataDecryptorFactory(org.bouncycastle.openpgp.PGPPrivateKey privateKey, SubkeyIdentifier decryptionKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()byte[]costlyRecoverSessionData(int keyAlgorithm, byte[][] secKeyData)SubkeyIdentifiergetSubkeyIdentifier()Return theSubkeyIdentifierfor which this particularCustomPublicKeyDataDecryptorFactoryis intended.byte[]recoverSessionData(int keyAlgorithm, byte[][] secKeyData)-
Methods inherited from class org.bouncycastle.openpgp.operator.bc.BcPublicKeyDataDecryptorFactory
createDataDecryptor, createDataDecryptor, createDataDecryptor
-
-
-
-
Constructor Detail
-
CachingBcPublicKeyDataDecryptorFactory
public CachingBcPublicKeyDataDecryptorFactory(org.bouncycastle.openpgp.PGPPrivateKey privateKey, SubkeyIdentifier decryptionKey)
-
-
Method Detail
-
recoverSessionData
public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData) throws org.bouncycastle.openpgp.PGPException- Specified by:
recoverSessionDatain interfaceorg.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory- Overrides:
recoverSessionDatain classorg.bouncycastle.openpgp.operator.bc.BcPublicKeyDataDecryptorFactory- Throws:
org.bouncycastle.openpgp.PGPException
-
costlyRecoverSessionData
public byte[] costlyRecoverSessionData(int keyAlgorithm, byte[][] secKeyData) throws org.bouncycastle.openpgp.PGPException- Throws:
org.bouncycastle.openpgp.PGPException
-
clear
public void clear()
-
getSubkeyIdentifier
public SubkeyIdentifier getSubkeyIdentifier()
Description copied from interface:CustomPublicKeyDataDecryptorFactoryReturn theSubkeyIdentifierfor which this particularCustomPublicKeyDataDecryptorFactoryis intended.- Specified by:
getSubkeyIdentifierin interfaceCustomPublicKeyDataDecryptorFactory- Returns:
- subkey identifier
-
-