Top Description Fields Constructors Methods
org.bouncycastle.crypto.engines

public Class IESEngine

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.crypto.engines.OldIESEngine
Imports
java.io.ByteArrayInputStream, .IOException, java.math.BigInteger, org.bouncycastle.crypto.BasicAgreement, .BufferedBlockCipher, .CipherParameters, .DerivationFunction, .EphemeralKeyPair, .InvalidCipherTextException, .KeyParser, .Mac, org.bouncycastle.crypto.generators.EphemeralKeyPairGenerator, org.bouncycastle.crypto.params.AsymmetricKeyParameter, .IESParameters, .IESWithCipherParameters, .KDFParameters, .KeyParameter, .ParametersWithIV, org.bouncycastle.util.Arrays, .BigIntegers, .Pack

Support class for constructing integrated encryption ciphers for doing basic message exchanges on top of key agreement ciphers. Follows the description given in IEEE Std 1363a.

Field Summary

Modifier and TypeField and Description
pack-priv BasicAgreement
pack-priv BufferedBlockCipher
pack-priv boolean
private byte[]
pack-priv DerivationFunction
private EphemeralKeyPairGenerator
private KeyParser
pack-priv Mac
pack-priv byte[]
pack-priv IESParameters
pack-priv CipherParameters
pack-priv CipherParameters
pack-priv byte[]
V

Constructor Summary

AccessConstructor and Description
public
IESEngine(BasicAgreement
the key agreement used as the basis for the encryption
agree
,
DerivationFunction
the key derivation function used for byte generation
kdf
,
Mac
the message authentication code generator for the message
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.

public
IESEngine(BasicAgreement
the key agreement used as the basis for the encryption
agree
,
DerivationFunction
the key derivation function used for byte generation
kdf
,
Mac
the message authentication code generator for the message
mac
,
BufferedBlockCipher
the cipher to used for encrypting the message
cipher
)

Set up for use in conjunction with a block cipher to handle the message.

Method Summary

Modifier and TypeMethod and Description
private byte[]
decryptBlock(byte[] in_enc, int inOff, int inLen)

private byte[]
encryptBlock(byte[] in, int inOff, int inLen)

private void
public BufferedBlockCipher
protected byte[]
getLengthTag(byte[] p2)

public Mac
public void
init(boolean
whether or not this is encryption/decryption.
forEncryption
,
CipherParameters
our private key parameters
privParam
,
CipherParameters
the recipient's/sender's public key parameters
pubParam
,
CipherParameters
encoding and derivation parameters, may be wrapped to include an IV for an underlying block cipher.
params
)

Initialise the encryptor.

public void
init(AsymmetricKeyParameter
the recipient's/sender's public key parameters
publicKey
,
CipherParameters
encoding and derivation parameters, may be wrapped to include an IV for an underlying block cipher.
params
,
EphemeralKeyPairGenerator
the ephemeral key pair generator to use.
ephemeralKeyPairGenerator
)

Initialise the decryptor.

public void
init(AsymmetricKeyParameter
the recipient's private key.
privateKey
,
CipherParameters
encoding and derivation parameters, may be wrapped to include an IV for an underlying block cipher.
params
,
KeyParser
the parser for reading the ephemeral public key.
publicKeyParser
)

Initialise the encryptor.

public byte[]
processBlock(byte[] in, int inOff, int inLen)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

agreeback to summary
pack-priv BasicAgreement agree
cipherback to summary
pack-priv BufferedBlockCipher cipher
forEncryptionback to summary
pack-priv boolean forEncryption
IVback to summary
private byte[] IV
kdfback to summary
pack-priv DerivationFunction kdf
keyPairGeneratorback to summary
private EphemeralKeyPairGenerator keyPairGenerator
keyParserback to summary
private KeyParser keyParser
macback to summary
pack-priv Mac mac
macBufback to summary
pack-priv byte[] macBuf
paramback to summary
pack-priv IESParameters param
privParamback to summary
pack-priv CipherParameters privParam
pubParamback to summary
pack-priv CipherParameters pubParam
Vback to summary
pack-priv byte[] V

Constructor Detail

IESEngineback to summary
public 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.

Parameters
agree:BasicAgreement

the key agreement used as the basis for the encryption

kdf:DerivationFunction

the key derivation function used for byte generation

mac:Mac

the message authentication code generator for the message

IESEngineback to summary
public IESEngine(BasicAgreement agree, DerivationFunction kdf, Mac mac, BufferedBlockCipher cipher)

Set up for use in conjunction with a block cipher to handle the message. It is strongly recommended that the cipher is not in ECB mode.

Parameters
agree:BasicAgreement

the key agreement used as the basis for the encryption

kdf:DerivationFunction

the key derivation function used for byte generation

mac:Mac

the message authentication code generator for the message

cipher:BufferedBlockCipher

the cipher to used for encrypting the message

Method Detail

decryptBlockback to summary
private byte[] decryptBlock(byte[] in_enc, int inOff, int inLen) throws InvalidCipherTextException
encryptBlockback to summary
private byte[] encryptBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
extractParamsback to summary
private void extractParams(CipherParameters params)
getCipherback to summary
public BufferedBlockCipher getCipher()
getLengthTagback to summary
protected byte[] getLengthTag(byte[] p2)
getMacback to summary
public Mac getMac()
initback to summary
public void init(boolean forEncryption, CipherParameters privParam, CipherParameters pubParam, CipherParameters params)

Initialise the encryptor.

Parameters
forEncryption:boolean

whether or not this is encryption/decryption.

privParam:CipherParameters

our private key parameters

pubParam:CipherParameters

the recipient's/sender's public key parameters

params:CipherParameters

encoding and derivation parameters, may be wrapped to include an IV for an underlying block cipher.

initback to summary
public void init(AsymmetricKeyParameter publicKey, CipherParameters params, EphemeralKeyPairGenerator ephemeralKeyPairGenerator)

Initialise the decryptor.

Parameters
publicKey:AsymmetricKeyParameter

the recipient's/sender's public key parameters

params:CipherParameters

encoding and derivation parameters, may be wrapped to include an IV for an underlying block cipher.

ephemeralKeyPairGenerator:EphemeralKeyPairGenerator

the ephemeral key pair generator to use.

initback to summary
public void init(AsymmetricKeyParameter privateKey, CipherParameters params, KeyParser publicKeyParser)

Initialise the encryptor.

Parameters
privateKey:AsymmetricKeyParameter

the recipient's private key.

params:CipherParameters

encoding and derivation parameters, may be wrapped to include an IV for an underlying block cipher.

publicKeyParser:KeyParser

the parser for reading the ephemeral public key.

processBlockback to summary
public byte[] processBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException