public class CCMCMSParameters
extends java.security.AlgorithmParametersSpi
AlgorithmParameters.getInstance
methods. Subsequently the new AlgorithmParameters object must be initialized with
a proper parameter specification (class CCMCMSParameterSpec is recommended) or a DER encoded byte array, e.g.
CCMCMSParameterSpec ccmcmsParamSpec = ...; AlgorithmParameters params = AlgorithmParameters.getInstance("CCMCMS", "IAIK"); params.init(ccmcmsParamsSpec);The CCMCMSParameters can also be initialized with an IvParameterSpec object. In this case, the specified IV will be used as nonce.
Constructor and Description |
---|
CCMCMSParameters()
The default constructor.
|
CCMCMSParameters(byte[] associatedData,
byte[] nonce,
byte[] macBlock,
int macLength)
Creates CCM Parameters with the given associated data, nonce and MAC length.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
engineGetEncoded()
Returns the parameters as DER byte array.
|
protected byte[] |
engineGetEncoded(java.lang.String format)
Returns the parameters as a DER byte array.
|
protected java.security.spec.AlgorithmParameterSpec |
engineGetParameterSpec(java.lang.Class paramSpec)
Returns a CCM Parameter Specification of this CCM Parameters object.
|
protected void |
engineInit(java.security.spec.AlgorithmParameterSpec paramSpec)
Initializes this parameters object using the parameters specified in paramSpec.
|
protected void |
engineInit(byte[] params)
Initializes this CCMCMSParameters object from the given DER encoded byte array.
|
protected void |
engineInit(byte[] params,
java.lang.String format)
Inits the parameters from an DER encoded byte array.
|
protected java.lang.String |
engineToString()
Returns a formatted string describing the CCM Parameters.
|
public CCMCMSParameters() throws java.security.InvalidAlgorithmParameterException
AlgorithmParameters.getInstance
for obtaining CCMCMSParameters.java.security.InvalidAlgorithmParameterException
- if the parameter values are incorrectpublic CCMCMSParameters(byte[] associatedData, byte[] nonce, byte[] macBlock, int macLength) throws java.security.InvalidAlgorithmParameterException
nonce
- the unique noncemacLength
- number of bytes used for Authenticationjava.security.InvalidAlgorithmParameterException
- if the parameter values are incorrectprotected byte[] engineGetEncoded() throws java.io.IOException
engineGetEncoded
in class java.security.AlgorithmParametersSpi
java.io.IOException
- if an encoding error occursprotected byte[] engineGetEncoded(java.lang.String format) throws java.io.IOException
Format is ignored. Only DER encoding is supported at this time. This method
only calls engineGetEncoded()
, regardless of what
is specified in the format
string.
engineGetEncoded
in class java.security.AlgorithmParametersSpi
format
- the encoding format; ignoredjava.io.IOException
- if an encoding error occursprotected java.security.spec.AlgorithmParameterSpec engineGetParameterSpec(java.lang.Class paramSpec) throws java.security.spec.InvalidParameterSpecException
CCMCMSParameterSpec
than a InvalidParameterSpecException
is thrown.engineGetParameterSpec
in class java.security.AlgorithmParametersSpi
paramSpec
- the specification class in which the parameters should be returned
- has to be the class CCMCMSParameterSpec
java.security.spec.InvalidParameterSpecException
- if the requested parameter specification is inappropriate
for this parameter object.protected void engineInit(java.security.spec.AlgorithmParameterSpec paramSpec) throws java.security.spec.InvalidParameterSpecException
engineInit
in class java.security.AlgorithmParametersSpi
paramSpec
- the parameter specification - must be CCMCMSParameterSpec
.java.security.spec.InvalidParameterSpecException
- if the given parameter specification is
inappropriate for the initialization of this parameter object.protected void engineInit(byte[] params) throws java.io.IOException
engineInit
in class java.security.AlgorithmParametersSpi
params
- the DER encoded byte arrayjava.io.IOException
- if an error occurs when decoding the given byte array or
the derived parameter values are invalidprotected void engineInit(byte[] params, java.lang.String format) throws java.io.IOException
engineInit(params)
for initializing this CCMCMSParameters
object from the given DER encoded byte array, regardless of what is specified
in the format
string.
engineInit
in class java.security.AlgorithmParametersSpi
params
- the DER encoded byte arrayformat
- the encoding format; ignoredjava.io.IOException
- if an error occurs when decoding the given byte arrayprotected java.lang.String engineToString()
engineToString
in class java.security.AlgorithmParametersSpi