public class ECEngine
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static int |
BLOCKSIZE |
private BufferedBlockCipher |
cipher |
private static int |
CIPHERKEYSIZE |
private IESEngine |
engine |
private IESParameters |
param |
Constructor and Description |
---|
ECEngine(BufferedBlockCipher cipher,
CipherParameters nonce,
APrioriInfo sharedInfo)
Constructor, specify the block cipher to use such as CBC or BlowFish.
|
ECEngine(BufferedBlockCipher cipher,
CipherParameters nonce,
Digest digest,
APrioriInfo sharedInfo)
Constructor, specify the block cipher and digest to use
|
ECEngine(CipherParameters nonce,
APrioriInfo sharedInfo)
The default constructor, creates an instance of the ECEngine using the
following default parameters, it is recommended that you use this
constructor unless you have a pressing need to deviate from the default
parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
init(boolean forEncrypt,
CipherParameters priKey,
CipherParameters pubKey)
A wrapper for IESEngine, initializes the elliptic curve encryption engine
in either encryption or decryption mode.
|
byte[] |
processBlock(byte[] in)
A wrapper for IESEngine processBlock() method, receives user input and
encrypts or decrypts the input received.
|
byte[] |
processBlock(byte[] in,
int inOff,
int inLen)
A wrapper for IESEngine processBlock() method, receives user input and
encrypts or decrypts the input received.
|
private static final int BLOCKSIZE
private static final int CIPHERKEYSIZE
private IESEngine engine
private BufferedBlockCipher cipher
private IESParameters param
public ECEngine(CipherParameters nonce, APrioriInfo sharedInfo)
nonce
- the cryptographic nonce which is used to generate IVssharedInfo
- the shared information exchanged by users a prioripublic ECEngine(BufferedBlockCipher cipher, CipherParameters nonce, APrioriInfo sharedInfo)
cipher
- The buffered block cipher to use such as CBC or BlowFishnonce
- the cryptographic nonce which is used to generate IVs, can be
null if the block cipher mode does not require an IVsharedInfo
- the shared information exchanged by users a priori
TODO: Not sure whether to have it to just take a cipher that implements
BlockCipher interface and instantiate the BufferedBlockCipher or to allow
it to take the BufferedBlockCipher and simply use that... BufferedBlockCipher
has multiple subclasses which could be used such as CTSBlockCipherpublic ECEngine(BufferedBlockCipher cipher, CipherParameters nonce, Digest digest, APrioriInfo sharedInfo)
cipher
- The buffered block cipher to use such as CBC or BlowFishnonce
- the cryptographic nonce which is used to generate IVs, can be
null if the block cipher mode does not require an IVdigest
- The digest to use for KDF/HMAC such as SHA256/MD5sharedInfo
- the shared information exchanged by users a prioripublic void init(boolean forEncrypt, CipherParameters priKey, CipherParameters pubKey)
forEncrypt
- Engine mode, true for encryption, false for decryptionpriKey
- Your private key parameterspubKey
- The recipient's public key parameterspublic byte[] processBlock(byte[] in) throws InvalidCipherTextException
in
- The input to encrypt or decryptInvalidCipherTextException
- if the encryption/decryption fails or if
the HMAC is invalid (possible data corruption or tampering)public byte[] processBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
in
- The input to encrypt or decryptinOff
- The offset in the input to encrypt/decryptinLen
- The length of the input to encyrpt/decryptInvalidCipherTextException
- if the encryption/decryption fails or if
the HMAC is invalid (possible data corruption or tampering)