de.flexiprovider.ec
Class ECIES
java.lang.Object
|
+--javax.crypto.CipherSpi
|
+--de.flexiprovider.api.Cipher
|
+--de.flexiprovider.api.AsymmetricHybridCipher
|
+--de.flexiprovider.common.ies.IES
|
+--de.flexiprovider.ec.ECIES
- public class ECIES
- extends IES
ECIES (Elliptic Curve Integrated Encryption Scheme) extends the basic IES
implementation.
|
Constructor Summary |
ECIES()
|
| 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, update |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ECIES
public ECIES()
getName
public java.lang.String getName()
- Overrides:
getName in class Cipher
- Returns:
- the name of this cipher
getKeySize
public int getKeySize(Key key)
throws InvalidKeyException
- Return the key size of the given key object in bits. Checks whether the
key object is an instance of ECPublicKey or
ECPrivateKey.
- Overrides:
getKeySize in class Cipher
- Parameters:
key - the key object- Returns:
- the key size of the given key object.
- Throws:
InvalidKeyException - if key is invalid.
checkPubKey
protected PublicKey checkPubKey(Key key)
throws InvalidKeyException
- Check whether the given encryption key is an instance of
ECPublicKey. If not, terminate with an
InvalidKeyException. Otherwise, assign the key parameters and
return the checked key.
- Overrides:
checkPubKey in class IES
- Parameters:
key - the key to be checked- Returns:
- the checked key
- Throws:
InvalidKeyException - if the key is not an instance of ECPublicKey.
checkPrivKey
protected PrivateKey checkPrivKey(Key key)
throws InvalidKeyException
- Check whether the given encryption key is an instance of
ECPrivateKey. If not, terminate with an
InvalidKeyException. Otherwise, assign the key parameters and
return the checked key.
- Overrides:
checkPrivKey in class IES
- Parameters:
key - the key to be checked- Returns:
- the checked key
- Throws:
InvalidKeyException - if the key is not an instance of ECPrivateKey.
getKeyAgreement
protected KeyAgreement getKeyAgreement()
- Instantiate and return the key agreement module.
- Overrides:
getKeyAgreement in class IES
- Returns:
- the key agreement module
generateEphKeyPair
protected KeyPair generateEphKeyPair()
- Generate an ephemeral key pair. This method is used in case no ephemeral
key pair is specified via the parameters during initialization.
- Overrides:
generateEphKeyPair in class IES
- Returns:
- the generated ephemeral key pair
encodeEphPubKey
protected byte[] encodeEphPubKey(PublicKey ephPubKey)
- Encode the ephemeral public key.
- Overrides:
encodeEphPubKey in class IES
- Parameters:
ephPubKey - the ephemeral public key- Returns:
- the encoded key
getEncEphPubKeySize
protected int getEncEphPubKeySize()
- Compute and return the size (in bytes) of the encoded ephemeral public
key.
- Overrides:
getEncEphPubKeySize in class IES
- Returns:
- the size of the encoded ephemeral public key
decodeEphPubKey
protected PublicKey decodeEphPubKey(byte[] encEphPubKey)
- Decode the ephemeral public key.
- Overrides:
decodeEphPubKey in class IES
- Parameters:
encEphPubKey - the encoded ephemeral public key- Returns:
- the decoded key