|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.AlgorithmParametersSpi | +--iaik.security.cipher.IvParameters | +--iaik.security.cipher.RC5Parameters
This class represents RC5 paramters in opaque form and may be used for generating opaque RC5 parameters and converting them between various formats.
The parameters specified for the RC5 algorithm in RFC2040 specify the version number, the number of rounds, the word size (block size in bits) and an optional initialization vector:
RC5-CBCParameters :: SEQUENCE { version INTEGER (v1_0(16)), rounds INTEGER (8..127), blockSizeInBits INETGER (64, 128), iv OCTET STRING OPTIONAL }
RC5Paramters may be generated provider independently by calling one of the
AlgorithmParameters.getInstance
methods for the algorithm in
mind. Subsequently the new AlgorithmParamters object must be initialized with
a proper RC5 parameter specification or a DER encoded byte array. If the first
way is chosen, the parameter values (version, rounds, wordsize, and IV, if present)
for initializing the new AlgorithmParameters object immediately are taken from
the given RC5 parameter specification; if the parameters are given
as DER encoded byte array, the values are parsed from the derived ASN.1 object,
e.g.:
RC5ParameterSpec rc5ParmSpec = ...; AlgorithmParameters params = AlgorithmParameters.getInstance("RC5", "IAIK"); params.init(rc5ParamsSpec);
For obtaining RC5 parameters in transparent representation from an opaque
RC5Paramters object, the getParameterSpec
method can be used;
for obtaining the parameters as DER encoded ASN.1 object, use
getEncoded
.
Please notice, that this implementation only allows a wordsize of 32 bit, i.e. 64 bit blocksize. The iv needs to be eight octets long, too.
Constructor Summary | |
RC5Parameters()
The default constructor. |
Method Summary | |
protected byte[] |
engineGetEncoded()
Returns the parameters as DER byte array. |
protected byte[] |
engineGetEncoded(String format)
Returns the parameters as a DER byte array. |
protected AlgorithmParameterSpec |
engineGetParameterSpec(Class paramSpec)
Returns the RC5 parameters as transparent RC5 parameter specification of the given class type. |
protected void |
engineInit(AlgorithmParameterSpec paramSpec)
Initializes this RC5Parameters with the RC5 parameter values from a given RC5ParameterSpec. |
protected void |
engineInit(byte[] params)
Initializes this RC5Parameters object from the given DER encoded byte array. |
protected void |
engineInit(byte[] params,
String format)
Inits the parameters from an DER encoded byte array. |
protected String |
engineToString()
Returns a String representation of the parameters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RC5Parameters()
RC5Parameters
object.
Applications shall use one of the AlgorithmParameters.getInstance
factory methods for obtaining RC5Parameters.Method Detail |
protected byte[] engineGetEncoded() throws IOException
engineGetEncoded
in class IvParameters
IOException
- if an encoding error occursprotected byte[] engineGetEncoded(String format) throws 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 IvParameters
format
- the encoding format; ignoredIOException
- if an encoding error occursprotected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec) throws InvalidParameterSpecException
engineGetParameterSpec
in class IvParameters
paramSpec
- the desired parameter specification class (RC5ParameterSpec)InvalidParameterSpecException
- if the paramters cannot be converted to
the desired parameter specificationprotected void engineInit(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException
engineInit
in class IvParameters
paramSpec
- the parameter specification, which has to be a RC5ParameterSpecInvalidParameterSpecException
- if the given parameter specification
is not a RC5ParameterSpec or the included
parameters are invalidprotected void engineInit(byte[] params) throws IOException
From the given byte array an ASN.1 object is created and parsed for the inherent RC5 parameter values.
engineInit
in class IvParameters
params
- the DER encoded byte arrayIOException
- if an error occurs when decoding the given byte array or
the derived parameter values are invalidprotected void engineInit(byte[] params, String format) throws IOException
engineInit(params)
for initializing this RC5Paramters
object from the given DER encoded byte array, regardless of what is specified
in the format
string.
engineInit
in class IvParameters
params
- the DER encoded byte arrayformat
- the encoding format; ignoredIOException
- if an error occurs when decoding the given byte arrayprotected String engineToString()
engineToString
in class IvParameters
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |