public class CBCCMacParameters
extends java.security.AlgorithmParametersSpi
CBC-CMAC-Param ::= SEQUENCE { aes-iV OCTET STRING aes-MacLen INTEGER (12 | 13 | 14 | 15 | 16) DEFAULT 16 }Additionally, this class may hold the associated data and MAC block.
AES CBCCMacParameters can be generated by calling one of the AlgorithmParameters.getInstance
methods. Subsequently, the new AlgorithmParameters object must be initialized with
a proper parameter specification (class CBCCMacParameterSpec is recommended) or a DER encoded byte array, e.g.
CBCCMacParameterSpec paramSpec = ...; AlgorithmParameters params = AlgorithmParameters.getInstance("AES-CBC-CMAC", "IAIK"); params.init(gcmParamsSpec);The AES CBCCMacParameters can also be initialized with an IvParameterSpec object representing the initialization vector.
Constructor and Description |
---|
CBCCMacParameters()
The default constructor.
|
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 AES-CBC-CMAC Parameter Specification of this AES-CBC-CMAC 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 CBCCMacParameters 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 GCM Parameters.
|
public CBCCMacParameters() throws java.security.InvalidAlgorithmParameterException
AlgorithmParameters.getInstance
for obtaining a AES CBCCMacParameters object.java.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
paramSpec
identifies the
specification class in which the parameters should be returned. If paramSpec is not
CBCCMacParameterSpec
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 CBCCMacParameterSpec
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 CBCCMacParameterSpec
.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 AES CBCCMacParameters
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