|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--javax.crypto.CipherSpi
|
+--de.flexiprovider.api.Cipher
|
+--de.flexiprovider.api.AsymmetricHybridCipher
|
+--de.flexiprovider.common.ies.IES
The Integrated Encryption Scheme (IES) is an encryption scheme based on a key agreement scheme using an ephemeral key pair, a symmetric cipher, and a message authentication code (MAC) to encrypt and decrypt data. IES is described in IEEE 1363a-2004.
| Field Summary | |
protected AlgorithmParameterSpec |
keyParams
The algorithm parameters obtained from the (private or public) key. |
protected SecureRandom |
random
the source of randomness |
| Fields inherited from class de.flexiprovider.api.AsymmetricHybridCipher |
paramSpec |
| Fields inherited from class de.flexiprovider.api.Cipher |
DECRYPT_MODE, ENCRYPT_MODE, opMode |
| Constructor Summary | |
protected |
IES()
Constructor. |
| Method Summary | |
protected abstract PrivateKey |
checkPrivKey(Key key)
Check whether the given decryption key is of the correct type. |
protected abstract PublicKey |
checkPubKey(Key key)
Check whether the given encryption key is of the correct type. |
protected abstract PublicKey |
decodeEphPubKey(byte[] encEphPubKey)
Decode the ephemeral public key. |
protected int |
decryptOutputSize(int inLen)
Compute the output size of an update() or doFinal() operation of a hybrid asymmetric cipher in decryption mode when given input of the specified length. |
byte[] |
doFinal(byte[] input,
int inOff,
int inLen)
Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. |
protected abstract byte[] |
encodeEphPubKey(PublicKey ephPubKey)
Encode the ephemeral public key. |
protected int |
encryptOutputSize(int inLen)
Compute the output size of an update() or doFinal() operation of a hybrid asymmetric cipher in encryption mode when given input of the specified length. |
protected abstract KeyPair |
generateEphKeyPair()
Generate an ephemeral key pair. |
protected abstract int |
getEncEphPubKeySize()
Compute and return the size (in bytes) of the encoded ephemeral public key. |
protected abstract KeyAgreement |
getKeyAgreement()
Instantiate and return the key agreement module. |
protected void |
initCipherDecrypt(Key key,
AlgorithmParameterSpec params)
Initialize the cipher with a certain key for data encryption. |
protected void |
initCipherEncrypt(Key key,
AlgorithmParameterSpec params,
SecureRandom random)
Initialize the cipher with a key and parameters for data encryption. |
protected byte[] |
messageDecrypt(byte[] input)
Decrypt the ciphertext stored in input. |
protected byte[] |
messageEncrypt(byte[] input)
Encrypt the plaintext stored in input. |
byte[] |
update(byte[] input,
int inOff,
int inLen)
Continue a multiple-part encryption or decryption operation. |
| Methods inherited from class de.flexiprovider.api.AsymmetricHybridCipher |
doFinal, getBlockSize, getIV, getOutputSize, getParameters, initDecrypt, initDecrypt, initEncrypt, initEncrypt, initEncrypt, initEncrypt, setMode, setPadding, update |
| Methods inherited from class de.flexiprovider.api.Cipher |
doFinal, doFinal, engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetKeySize, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUpdate, engineUpdate, getKeySize, getName, update |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected SecureRandom random
protected AlgorithmParameterSpec keyParams
| Constructor Detail |
protected IES()
| Method Detail |
public byte[] update(byte[] input,
int inOff,
int inLen)
update in class AsymmetricHybridCipherinput - byte array containing the next part of the inputinOff - index in the array where the input startsinLen - length of the input
public byte[] doFinal(byte[] input,
int inOff,
int inLen)
throws BadPaddingException
doFinal in class AsymmetricHybridCipherinput - the input bufferinOff - the offset in input where the input startsinLen - the input lengthBadPaddingException - if this cipher is in decryption mode, and (un)padding has
been requested, but the decrypted data is not bounded by
the appropriate padding bytes
protected void initCipherEncrypt(Key key,
AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
IESParameterSpec.initCipherEncrypt in class AsymmetricHybridCipherkey - the keyparams - the parametersrandom - the source of randomnessInvalidKeyException - if the key is inappropriate.InvalidAlgorithmParameterException - if the parameters are not an instance of
IESParameterSpec or the ephemeral key pair stored
in the parameters is invalid.
protected void initCipherDecrypt(Key key,
AlgorithmParameterSpec params)
throws InvalidKeyException,
InvalidAlgorithmParameterException
initCipherDecrypt in class AsymmetricHybridCipherkey - the keyparams - the algorithm parametersInvalidKeyException - if the given key is inappropriate for initializing this
cipher.InvalidAlgorithmParameterException - if the given parameters are inappropriate for
initializing this cipher.protected int decryptOutputSize(int inLen)
AsymmetricHybridCipherdecryptOutputSize in class AsymmetricHybridCipherde.flexiprovider.api.AsymmetricHybridCipherinLen - the length of the inputprotected int encryptOutputSize(int inLen)
AsymmetricHybridCipherencryptOutputSize in class AsymmetricHybridCipherde.flexiprovider.api.AsymmetricHybridCipherinLen - the length of the input
protected byte[] messageEncrypt(byte[] input)
throws BadPaddingException
input - the plaintext to be encryptedBadPaddingException - if encryption fails.
protected byte[] messageDecrypt(byte[] input)
throws BadPaddingException
input - the message to be decryptedBadPaddingException - if the ciphertext is invalid.
protected abstract PublicKey checkPubKey(Key key)
throws InvalidKeyException
InvalidKeyException.key - the key to be checkedInvalidKeyException - if the given key is inappropriate.
protected abstract PrivateKey checkPrivKey(Key key)
throws InvalidKeyException
InvalidKeyException.key - the key to be checkedInvalidKeyException - if the given key is inappropriate.protected abstract KeyAgreement getKeyAgreement()
protected abstract KeyPair generateEphKeyPair()
IESParameterSpec during
initialization.protected abstract byte[] encodeEphPubKey(PublicKey ephPubKey)
ephPubKey - the ephemeral public keyprotected abstract int getEncEphPubKeySize()
protected abstract PublicKey decodeEphPubKey(byte[] encEphPubKey)
encEphPubKey - the encoded ephemeral public key
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||