public class IESEngine
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) BasicAgreement |
agree |
(package private) BufferedBlockCipher |
cipher |
(package private) boolean |
forEncryption |
(package private) DerivationFunction |
kdf |
(package private) Mac |
mac |
(package private) byte[] |
macBuf |
(package private) CipherParameters |
nonce |
(package private) IESParameters |
param |
(package private) CipherParameters |
privParam |
(package private) CipherParameters |
pubParam |
Constructor and Description |
---|
IESEngine(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.
|
IESEngine(BasicAgreement agree,
DerivationFunction kdf,
Mac mac,
BufferedBlockCipher cipher,
CipherParameters nonce)
TODO PERHAPS MAKE A NONCE INTERFACE RATHER THAN USING CIPHERPARAMETERS
WHICH DOES NOT ACTUALLY HAVE ANYTHING SPECIFIED IN THE INTERFACE.
|
Modifier and Type | Method and Description |
---|---|
private byte[] |
decryptBlock(byte[] in_enc,
int inOff,
int inLen,
byte[] z) |
private byte[] |
encryptBlock(byte[] in,
int inOff,
int inLen,
byte[] z) |
private byte[] |
generateKdfBytes(KDFParameters kParam,
int length) |
void |
init(boolean forEncryption,
CipherParameters privParam,
CipherParameters pubParam,
CipherParameters param)
Initialise the encryptor.
|
byte[] |
processBlock(byte[] in,
int inOff,
int inLen) |
BasicAgreement agree
DerivationFunction kdf
Mac mac
BufferedBlockCipher cipher
CipherParameters nonce
byte[] macBuf
boolean forEncryption
CipherParameters privParam
CipherParameters pubParam
IESParameters param
public IESEngine(BasicAgreement agree, DerivationFunction kdf, Mac mac)
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 messagepublic IESEngine(BasicAgreement agree, DerivationFunction kdf, Mac mac, BufferedBlockCipher cipher)
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 messagepublic IESEngine(BasicAgreement agree, DerivationFunction kdf, Mac mac, BufferedBlockCipher cipher, CipherParameters nonce)
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 messagenonce
- the nonce/IV used by the block cipher, currently the only
supported block ciphers are SIC/CTR, CBC, OFB, and CFB. The nonce
provided must be an instance of the Nonce class.public void init(boolean forEncryption, CipherParameters privParam, CipherParameters pubParam, CipherParameters param)
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.private byte[] decryptBlock(byte[] in_enc, int inOff, int inLen, byte[] z) throws InvalidCipherTextException
InvalidCipherTextException
private byte[] encryptBlock(byte[] in, int inOff, int inLen, byte[] z) throws InvalidCipherTextException
InvalidCipherTextException
private byte[] generateKdfBytes(KDFParameters kParam, int length)
public byte[] processBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
InvalidCipherTextException