de.flexiprovider.common.ies
Class IESParameterSpec
java.lang.Object
|
+--de.flexiprovider.common.ies.IESParameterSpec
- All Implemented Interfaces:
- AlgorithmParameterSpec, java.security.spec.AlgorithmParameterSpec
- public class IESParameterSpec
- extends java.lang.Object
- implements AlgorithmParameterSpec
This class implements the IES algorithm parameters.
- Author:
- Marcus Stögbauer, Hristo Indzhov, Martin Döring
- See Also:
IES
|
Field Summary |
static java.lang.String |
DEFAULT_MAC
The default MAC function (HmacSHA1) |
static java.lang.String |
DEFAULT_SYM_CIPHER
The default symmetric cipher (AES128_CBC) |
|
Constructor Summary |
IESParameterSpec()
Constructor. |
IESParameterSpec(java.security.KeyPair ephKeyPair,
java.lang.String symCipherName,
java.lang.String macName,
byte[] macEncParam,
byte[] sharedInfo)
Constructor. |
IESParameterSpec(KeyPair ephKeyPair,
java.lang.String symCipherName,
java.lang.String macName,
byte[] macEncParam,
byte[] sharedInfo)
Constructor. |
IESParameterSpec(java.lang.String symCipherName,
java.lang.String macName,
byte[] macEncParam,
byte[] sharedInfo)
Constructor. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_SYM_CIPHER
public static final java.lang.String DEFAULT_SYM_CIPHER
- The default symmetric cipher (AES128_CBC)
DEFAULT_MAC
public static final java.lang.String DEFAULT_MAC
- The default MAC function (HmacSHA1)
IESParameterSpec
public IESParameterSpec(java.security.KeyPair ephKeyPair,
java.lang.String symCipherName,
java.lang.String macName,
byte[] macEncParam,
byte[] sharedInfo)
throws java.security.InvalidParameterException
- Constructor. If the specified symmetric cipher algorithm is null
, the
DEFAULT_SYM_CIPHER is chosen. If the specified MAC
function is null, the DEFAULT_MAC is chosen.
- Parameters:
ephKeyPair - the ephemeral key pair (used only for encryption)symCipherName - the name of the desired symmetric cipher algorithm ("internal"
for the internal cipher (one-time pad), or one of
"DESede_CBC", "AES128_CBC", "AES192_CBC", or "AES256_CBC").macName - the name of the desired MAC function ("HmacSHA1",
"HmacSHA256", "HmacSHA384", "HmacSHA512", or "HmacRIPEMD160").macEncParam - the encoding parameter used for the MACsharedInfo - the shared data used for the key derivation function- Throws:
java.security.InvalidParameterException - if the desired symmetric cipher algorithm or MAC function is
not supported.
IESParameterSpec
public IESParameterSpec()
- Constructor. Choose the
DEFAULT_SYM_CIPHER and the
DEFAULT_MAC. Set the encoding parameter for the MAC, the shared
data for the key derivation function, and the ephemeral key pair to
null.
IESParameterSpec
public IESParameterSpec(java.lang.String symCipherName,
java.lang.String macName,
byte[] macEncParam,
byte[] sharedInfo)
throws InvalidParameterException
- Constructor. If the specified symmetric cipher algorithm is null
, the
DEFAULT_SYM_CIPHER is chosen. If the specified MAC
function is null, the DEFAULT_MAC is chosen.
- Parameters:
symCipherName - the name of the desired symmetric cipher algorithm ("internal"
for the internal cipher (one-time pad), or one of
"DESede_CBC", "AES128_CBC", "AES192_CBC", or "AES256_CBC").macName - the name of the desired MAC function ("HmacSHA1",
"HmacSHA256", "HmacSHA384", "HmacSHA512", or "HmacRIPEMD160").macEncParam - the encoding parameter used for the MACsharedInfo - the shared data used for the key derivation function- Throws:
InvalidParameterException - if the desired symmetric cipher algorithm or MAC function is
not supported.
IESParameterSpec
public IESParameterSpec(KeyPair ephKeyPair,
java.lang.String symCipherName,
java.lang.String macName,
byte[] macEncParam,
byte[] sharedInfo)
throws InvalidParameterException
- Constructor. If the specified symmetric cipher algorithm is null
, the
DEFAULT_SYM_CIPHER is chosen. If the specified MAC
function is null, the DEFAULT_MAC is chosen.
- Parameters:
ephKeyPair - the ephemeral key pair (used only for encryption)symCipherName - the name of the desired symmetric cipher algorithm ("internal"
for the internal cipher (one-time pad), or one of
"DESede_CBC", "AES128_CBC", "AES192_CBC", or "AES256_CBC").macName - the name of the desired MAC function ("HmacSHA1",
"HmacSHA256", "HmacSHA384", "HmacSHA512", or "HmacRIPEMD160").macEncParam - the encoding parameter used for the MACsharedInfo - the shared data used for the key derivation function- Throws:
InvalidParameterException - if the desired symmetric cipher algorithm or MAC function is
not supported.
getEphKeyPair
public KeyPair getEphKeyPair()
- Return the ephemeral key pair. In case it is null, the IES
implementation has to generate an ephemeral key pair itself.
- Returns:
- the ephemeral key pair (may be null)
getSymCipherName
public java.lang.String getSymCipherName()
- Returns:
- the name of the symmetric cipher algorithm
getSymKFName
protected java.lang.String getSymKFName()
- Returns:
- the name of the key factory for the symmetric cipher algorithm
getSymKeyLength
protected int getSymKeyLength()
- Returns:
- the key length of the symmetric cipher algorithm
getMacName
public java.lang.String getMacName()
- Returns:
- the name of the MAC function
getMacKFName
protected java.lang.String getMacKFName()
- Returns:
- the name of the key factory for the MAC function
getMacEncParam
public byte[] getMacEncParam()
- Returns:
- the encoding parameters for the MAC function
getSharedInfo
public byte[] getSharedInfo()
- Returns:
- the shared data used for the key derivation function