Top Description Inners Fields Constructors Methods
org.bouncycastle.openpgp.operator.bc

public Class BcPublicKeyDataDecryptorFactory

extends AbstractPublicKeyDataDecryptorFactory
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, org.bouncycastle.asn1.cryptlib.CryptlibObjectIdentifiers, org.bouncycastle.asn1.edec.EdECObjectIdentifiers, org.bouncycastle.bcpg.AEADEncDataPacket, .ECDHPublicBCPGKey, .HashAlgorithmTags, .PublicKeyAlgorithmTags, .SymmetricEncIntegrityPacket, .SymmetricKeyAlgorithmTags, .X25519PublicBCPGKey, .X448PublicBCPGKey, org.bouncycastle.crypto.BlockCipher, .BufferedAsymmetricBlockCipher, .InvalidCipherTextException, .RawAgreement, .Wrapper, org.bouncycastle.crypto.agreement.ECDHBasicAgreement, .X25519Agreement, .X448Agreement, org.bouncycastle.crypto.params.AsymmetricKeyParameter, .ECDomainParameters, .ECPrivateKeyParameters, .ECPublicKeyParameters, .ElGamalPrivateKeyParameters, .KeyParameter, .X25519PublicKeyParameters, .X448PublicKeyParameters, org.bouncycastle.openpgp.PGPException, .PGPPrivateKey, .PGPSessionKey, org.bouncycastle.openpgp.operator.AbstractPublicKeyDataDecryptorFactory, .PGPDataDecryptor, .PGPPad, .RFC6637Utils, org.bouncycastle.util.Arrays, .BigIntegers

A decryptor factory for handling public key decryption operations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface

Field Summary

Modifier and TypeField and Description
private static final BcPGPKeyConverter
private final PGPPrivateKey

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PGPDataDecryptor
createDataDecryptor(boolean
true if the packet to be decrypted has integrity checking enabled.
withIntegrityPacket
,
int
the identifier of the encryption algorithm to decrypt with.
encAlgorithm
,
byte[]
the bytes of the key for the cipher.
key
)

Implements org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Constructs a data decryptor for SED or v1 SEIPD packets.

public PGPDataDecryptor
createDataDecryptor(AEADEncDataPacket
AEAD encrypted data packet
aeadEncDataPacket
,
PGPSessionKey
decrypted session key
sessionKey
)

Implements org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Constructs a data decryptor for AEAD Encrypted Data packets.

public PGPDataDecryptor
createDataDecryptor(SymmetricEncIntegrityPacket
version 2 symmetrically encrypted integrity-protected data packet using AEAD.
seipd
,
PGPSessionKey
decrypted session key
sessionKey
)

Implements org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Constructs a data decryptor for v2 SEIPD packets.

private static BufferedAsymmetricBlockCipher
private byte[]
getSessionData(byte[] enc, AsymmetricKeyParameter privKey, int pLen, int hashAlgorithm, int symmetricKeyAlgorithm, RawAgreement agreement, String algorithmName, boolean includesSesKeyAlg, BcPublicKeyDataDecryptorFactory.PublicKeyParametersOperation pkp)

private void
processEncodedMpi(BufferedAsymmetricBlockCipher c1, int size, byte[] tmp, byte[] bi)

private byte[]
recoverECDHSessionData(byte[][] secKeyData, AsymmetricKeyParameter privKey)

private byte[]
recoverElgamalSessionData(int keyAlgorithm, byte[][] secKeyData, AsymmetricKeyParameter privKey)

private byte[]
recoverRSASessionData(int keyAlgorithm, byte[][] secKeyData, AsymmetricKeyParameter privKey)

public byte[]
recoverSessionData(int
public key algorithm
keyAlgorithm
,
byte[][]
encrypted session key data
secKeyData
,
int
version of the PKESK packet
pkeskVersion
)

Implements org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory.recoverSessionData.

Recover the plain session info by decrypting the encrypted session key.

private static byte[]
unwrapSessionData(byte[] keyEnc, int symmetricKeyAlgorithm, KeyParameter key)

Inherited from org.bouncycastle.openpgp.operator.AbstractPublicKeyDataDecryptorFactory:
checkRangecontainsSKAlgprependSKAlgorithmToSessionDatarecoverSessionDatarecoverSessionData

Field Detail

KEY_CONVERTERback to summary
private static final BcPGPKeyConverter KEY_CONVERTER
pgpPrivKeyback to summary
private final PGPPrivateKey pgpPrivKey

Constructor Detail

BcPublicKeyDataDecryptorFactoryback to summary
public BcPublicKeyDataDecryptorFactory(PGPPrivateKey pgpPrivKey)

Method Detail

createDataDecryptorback to summary
public PGPDataDecryptor createDataDecryptor(boolean withIntegrityPacket, int encAlgorithm, byte[] key) throws PGPException

Implements org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Doc from org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Constructs a data decryptor for SED or v1 SEIPD packets.

Parameters
withIntegrityPacket:boolean

true if the packet to be decrypted has integrity checking enabled.

encAlgorithm:int

the identifier of the encryption algorithm to decrypt with.

key:byte[]

the bytes of the key for the cipher.

Returns:PGPDataDecryptor

a data decryptor that can decrypt (and verify) streams of encrypted data.

Annotations
@Override
Exceptions
PGPException:
if an error occurs initialising the decryption and integrity checking functions.
createDataDecryptorback to summary
public PGPDataDecryptor createDataDecryptor(AEADEncDataPacket aeadEncDataPacket, PGPSessionKey sessionKey) throws PGPException

Implements org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Doc from org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Constructs a data decryptor for AEAD Encrypted Data packets. This method is used with OpenPGP v5 AEAD.

Parameters
aeadEncDataPacket:AEADEncDataPacket

AEAD encrypted data packet

sessionKey:PGPSessionKey

decrypted session key

Returns:PGPDataDecryptor

a data decryptor that can decrypt (and verify) streams of encrypted data.

Annotations
@Override
Exceptions
PGPException:
if an error occurs initialising the decryption and integrity checking functions.
createDataDecryptorback to summary
public PGPDataDecryptor createDataDecryptor(SymmetricEncIntegrityPacket seipd, PGPSessionKey sessionKey) throws PGPException

Implements org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Doc from org.bouncycastle.openpgp.operator.PGPDataDecryptorFactory.createDataDecryptor.

Constructs a data decryptor for v2 SEIPD packets. This method is used with OpenPGP v6 AEAD.

Parameters
seipd:SymmetricEncIntegrityPacket

version 2 symmetrically encrypted integrity-protected data packet using AEAD.

sessionKey:PGPSessionKey

decrypted session key

Returns:PGPDataDecryptor

a data decryptor that can decrypt (and verify) streams of encrypted data.

Annotations
@Override
Exceptions
PGPException:
if an error occurs initialising the decryption and integrity checking functions.
getBufferedAsymmetricBlockCipherback to summary
private static BufferedAsymmetricBlockCipher getBufferedAsymmetricBlockCipher(int keyAlgorithm, AsymmetricKeyParameter privKey) throws PGPException
getSessionDataback to summary
private byte[] getSessionData(byte[] enc, AsymmetricKeyParameter privKey, int pLen, int hashAlgorithm, int symmetricKeyAlgorithm, RawAgreement agreement, String algorithmName, boolean includesSesKeyAlg, BcPublicKeyDataDecryptorFactory.PublicKeyParametersOperation pkp) throws PGPException, InvalidCipherTextException
processEncodedMpiback to summary
private void processEncodedMpi(BufferedAsymmetricBlockCipher c1, int size, byte[] tmp, byte[] bi)
recoverECDHSessionDataback to summary
private byte[] recoverECDHSessionData(byte[][] secKeyData, AsymmetricKeyParameter privKey) throws PGPException, IOException, InvalidCipherTextException
recoverElgamalSessionDataback to summary
private byte[] recoverElgamalSessionData(int keyAlgorithm, byte[][] secKeyData, AsymmetricKeyParameter privKey) throws PGPException, InvalidCipherTextException
recoverRSASessionDataback to summary
private byte[] recoverRSASessionData(int keyAlgorithm, byte[][] secKeyData, AsymmetricKeyParameter privKey) throws PGPException, InvalidCipherTextException
recoverSessionDataback to summary
public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData, int pkeskVersion) throws PGPException

Implements org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory.recoverSessionData.

Doc from org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory.recoverSessionData.

Recover the plain session info by decrypting the encrypted session key. This method returns the decrypted session info as-is (without prefixing missing cipher algorithm), so the return value is:

[sym-alg]?[session-key][checksum]?
Parameters
keyAlgorithm:int

public key algorithm

secKeyData:byte[][]

encrypted session key data

pkeskVersion:int

version of the PKESK packet

Returns:byte[]

decrypted session info

Annotations
@Override
unwrapSessionDataback to summary
private static byte[] unwrapSessionData(byte[] keyEnc, int symmetricKeyAlgorithm, KeyParameter key) throws PGPException, InvalidCipherTextException
org.bouncycastle.openpgp.operator.bc back to summary

private Interface BcPublicKeyDataDecryptorFactory.PublicKeyParametersOperation

Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public AsymmetricKeyParameter
getPublicKeyParameters(byte[] pEnc, int pEncOff)

Method Detail

getPublicKeyParametersback to summary
public AsymmetricKeyParameter getPublicKeyParameters(byte[] pEnc, int pEncOff)