Bouncy Castle Cryptography Library 1.81

org.bouncycastle.openpgp.operator
Class PBEDataDecryptorFactory

java.lang.Object
  extended byorg.bouncycastle.openpgp.operator.PBEDataDecryptorFactory
All Implemented Interfaces:
PGPDataDecryptorFactory
Direct Known Subclasses:
BcPBEDataDecryptorFactory

public abstract class PBEDataDecryptorFactory
extends java.lang.Object
implements PGPDataDecryptorFactory

A factory for performing PBE decryption operations. The purpose of this class is to act as an abstract factory, whose subclasses can decide, which concrete implementation to use for symmetric decryption of SKESK (symmetric-key-encrypted session-key) packets.


Constructor Summary
protected PBEDataDecryptorFactory(char[] passPhrase, PGPDigestCalculatorProvider calculatorProvider)
          Construct a PBE data decryptor factory.
 
Method Summary
 byte[] makeKeyFromPassPhrase(int keyAlgorithm, S2K s2k)
          Generates an encryption key using the pass phrase and digest calculator configured for this factory.
abstract  byte[] recoverAEADEncryptedSessionData(SymmetricKeyEncSessionPacket keyData, byte[] ikm)
          Recover the session data of a v5 SKESK or v6 SKESK packet.
abstract  byte[] recoverSessionData(int keyAlgorithm, byte[] key, byte[] seckKeyData)
          Decrypts session data from a v4 SKESK packet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory
createDataDecryptor, createDataDecryptor, createDataDecryptor
 

Constructor Detail

PBEDataDecryptorFactory

protected PBEDataDecryptorFactory(char[] passPhrase,
                                  PGPDigestCalculatorProvider calculatorProvider)
Construct a PBE data decryptor factory.

Parameters:
passPhrase - the pass phrase to generate decryption keys with.
calculatorProvider - the digest to use in key generation.
Method Detail

makeKeyFromPassPhrase

public byte[] makeKeyFromPassPhrase(int keyAlgorithm,
                                    S2K s2k)
                             throws PGPException
Generates an encryption key using the pass phrase and digest calculator configured for this factory.

Parameters:
keyAlgorithm - the encryption algorithm to generate a key for.
s2k - the string-to-key specification to use to generate the key.
Returns:
the key bytes for the encryption algorithm, generated using the pass phrase of this factory.
Throws:
PGPException - if an error occurs generating the key.

recoverSessionData

public abstract byte[] recoverSessionData(int keyAlgorithm,
                                          byte[] key,
                                          byte[] seckKeyData)
                                   throws PGPException
Decrypts session data from a v4 SKESK packet. These are used in OpenPGP v4.

Parameters:
keyAlgorithm - the encryption algorithm used to encrypt the session data.
key - the key bytes for the encryption algorithm.
seckKeyData - the encrypted session data to decrypt.
Returns:
the decrypted session data.
Throws:
PGPException - if an error occurs decrypting the session data.

recoverAEADEncryptedSessionData

public abstract byte[] recoverAEADEncryptedSessionData(SymmetricKeyEncSessionPacket keyData,
                                                       byte[] ikm)
                                                throws PGPException
Recover the session data of a v5 SKESK or v6 SKESK packet. These are used in OpenPGP v5 and v6.

Parameters:
keyData - v5 or v6 SKESK packet
ikm - initial keying material (e.g. S2K result)
Returns:
session key
Throws:
PGPException

Bouncy Castle Cryptography Library 1.81