Class IESEngine
java.lang.Object
org.gudy.bouncycastle.crypto.engines.IESEngine
support class for constructing intergrated encryption ciphers
for doing basic message exchanges on top of key agreement ciphers
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) BasicAgreement(package private) BufferedBlockCipher(package private) boolean(package private) DerivationFunction(package private) Mac(package private) byte[](package private) IESParameters(package private) CipherParameters(package private) CipherParameters -
Constructor Summary
ConstructorsConstructorDescriptionIESEngine(BasicAgreement agree, DerivationFunction kdf, Mac mac) set up for use with stream mode, where the key derivation function is used to provide a stream of bytes to xor with the message.IESEngine(BasicAgreement agree, DerivationFunction kdf, Mac mac, BufferedBlockCipher cipher) set up for use in conjunction with a block cipher to handle the message. -
Method Summary
Modifier and TypeMethodDescriptionprivate byte[]decryptBlock(byte[] in_enc, int inOff, int inLen, byte[] z) private byte[]encryptBlock(byte[] in, int inOff, int inLen, byte[] z) voidinit(boolean forEncryption, CipherParameters privParam, CipherParameters pubParam, CipherParameters param) Initialise the encryptor.byte[]processBlock(byte[] in, int inOff, int inLen)
-
Field Details
-
agree
BasicAgreement agree -
kdf
-
mac
Mac mac -
cipher
BufferedBlockCipher cipher -
macBuf
byte[] macBuf -
forEncryption
boolean forEncryption -
privParam
CipherParameters privParam -
pubParam
CipherParameters pubParam -
param
IESParameters param
-
-
Constructor Details
-
IESEngine
set up for use with stream mode, where the key derivation function is used to provide a stream of bytes to xor with the message.- Parameters:
agree- the key agreement used as the basis for the encryptionkdf- the key derivation function used for byte generationmac- the message authentication code generator for the message
-
IESEngine
set up for use in conjunction with a block cipher to handle the message.- Parameters:
agree- the key agreement used as the basis for the encryptionkdf- the key derivation function used for byte generationmac- the message authentication code generator for the messagecipher- the cipher to used for encrypting the message
-
-
Method Details
-
init
public void init(boolean forEncryption, CipherParameters privParam, CipherParameters pubParam, CipherParameters param) Initialise the encryptor.- Parameters:
forEncryption- whether or not this is encryption/decryption.privParam- our private key parameterspubParam- the recipient's/sender's public key parametersparam- encoding and derivation parameters.
-
decryptBlock
private byte[] decryptBlock(byte[] in_enc, int inOff, int inLen, byte[] z) throws InvalidCipherTextException - Throws:
InvalidCipherTextException
-
encryptBlock
private byte[] encryptBlock(byte[] in, int inOff, int inLen, byte[] z) throws InvalidCipherTextException - Throws:
InvalidCipherTextException
-
processBlock
- Throws:
InvalidCipherTextException
-