public final class HelixAlgorithmParameters extends AlgorithmParametersSpi
Constructor and Description |
---|
HelixAlgorithmParameters()
Creates a new HelixAlgorithmParameters and performs the provider
self-integrity check.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
engineGetEncoded()
Returns the parameters in their primary encoding format.
|
protected byte[] |
engineGetEncoded(String format)
Returns the parameters encoded in the specified format.
|
protected <T extends AlgorithmParameterSpec> |
engineGetParameterSpec(Class<T> paramSpec)
Returns a (transparent) specification of this parameters object.
|
protected void |
engineInit(AlgorithmParameterSpec paramSpec)
Initializes this parameters object using the parameters specified in
paramSpec.
|
protected void |
engineInit(byte[] params)
Imports the specified parameters and decodes them according to the
primary decoding format for parameters.
|
protected void |
engineInit(byte[] params,
String format)
Imports the parameters from params and decodes them according to
the specified decoding format.
|
protected String |
engineToString()
Returns a formatted string describing the parameters.
|
public HelixAlgorithmParameters()
protected void engineInit(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException
engineInit
in class AlgorithmParametersSpi
paramSpec
- the algorithm parameter specification (must be a
HelixParameterSpec
)InvalidParameterSpecException
- if paramSpec is null or not a
HelixParameterSpec
AlgorithmParametersSpi.engineInit(java.security.spec.AlgorithmParameterSpec)
protected void engineInit(byte[] params) throws IOException
Helix parameters are only encoded in ASN.1/DER format. There are two valid ASN.1/DER encodings for Helix parameters, as specified below.
Nonce-only (18 bytes, expressed in hexadecimal below):
04 10 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
Nonce + MAC (38 bytes, expressed in hexadecimal below):
30 24 04 10 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx 04 10 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
engineInit
in class AlgorithmParametersSpi
params
- the ASN.1/DER-encoded parametersIOException
- if params cannot be decoded according to the
specifications aboveAlgorithmParametersSpi.engineInit(byte[])
protected void engineInit(byte[] params, String format) throws IOException
Helix algorithm parameters only recognize ASN.1 or DER encoding.
If format is non-null and not ASN.1 or DER, an
attempt is made to decode params as ASN.1; if this attempt fails,
an IOException
is thrown.
If format is null, params is decoded assuming ASN.1.
engineInit
in class AlgorithmParametersSpi
params
- the encoded parametersformat
- the name of the decoding format (should be "ASN.1" or "DER")IOException
- if params cannot be decodedAlgorithmParametersSpi.engineInit(byte[],
java.lang.String)
protected <T extends AlgorithmParameterSpec> T engineGetParameterSpec(Class<T> paramSpec) throws InvalidParameterSpecException
engineGetParameterSpec
in class AlgorithmParametersSpi
paramSpec
- the specification class in which the parameters should be
returned (must be HelixParameterSpec
)InvalidParameterSpecException
- if paramSpec is null or not equal to the
class of HelixParameterSpec
AlgorithmParametersSpi.engineGetParameterSpec(java.lang.Class)
protected byte[] engineGetEncoded() throws IOException
Helix parameters are only encoded in ASN.1/DER format. There are two valid ASN.1/DER encodings for Helix parameters, as specified below.
Nonce-only (18 bytes, expressed in hexadecimal below):
04 10 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
Nonce + MAC (38 bytes, expressed in hexadecimal below):
30 24 04 10 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx 04 10 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
engineGetEncoded
in class AlgorithmParametersSpi
IOException
- if an error occurs while encoding the Helix parametersAlgorithmParametersSpi.engineGetEncoded()
protected byte[] engineGetEncoded(String format) throws IOException
Helix parameters are only encoded in ASN.1/DER format.
If format is non-null and not ASN.1 or DER, an
IOException
is thrown.
If format is null, params is encoded assuming ASN.1.
engineGetEncoded
in class AlgorithmParametersSpi
format
- the name of the encoding format (should be "ASN.1", "DER", or
null)IOException
- if format is non-null and not "ASN.1" or
"DER"; or if an error occurs while encoding the Helix
parametersAlgorithmParametersSpi.engineGetEncoded(java.lang.String)
protected String engineToString()
This method returns the appropriate PDU (protocol data unit) for the Helix parameters represented by this instance, according to the following ASN.1/DER type specification:
HelixParameters DEFINITIONS ::= BEGIN HelixNonce ::= OCTETSTRING HelixNonceAndMac ::= SEQUENCE { nonce OCTETSTRING, mac OCTETSTRING } END
If this instance represents a Helix nonce only, the following PDU is returned:
helixParameters HelixNonce ::= {"xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx"}
If this instance represents a Helix nonce and MAC, the following PDU is returned:
helixParameters HelixNonceAndMac ::= { nonce "xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx", mac "xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx" }
All bytes represented in PDUs are in hexadecimal format. If this instance has not yet been initialized, this method will return the result of super.toString().
engineToString
in class AlgorithmParametersSpi
AlgorithmParametersSpi.engineToString()
Copyright © 2010-2015 Matthew Zipay. All Rights Reserved.