public class ElGamalParameters
extends java.security.AlgorithmParametersSpi
Constructor and Description |
---|
ElGamalParameters()
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 DER byte array.
|
protected java.security.spec.AlgorithmParameterSpec |
engineGetParameterSpec(java.lang.Class paramSpec)
Returns the ElGamal parameters as transparent ElGamal parameter specification
of the given class type.
|
protected void |
engineInit(java.security.spec.AlgorithmParameterSpec paramSpec)
Initializes this ElGamalParameters with prime modulus
p , base generator g and
length l of the private value x, derived from the given ElGamalParameterSpec. |
protected void |
engineInit(byte[] params)
Initializes this ElGamalParameters object from the given DER encoded byte array.
|
protected void |
engineInit(byte[] params,
java.lang.String format)
Inits the parameters from a DER encoded byte array.
|
protected java.lang.String |
engineToString()
Returns a String representation of the parameters.
|
int |
hashCode()
Returns a hash code for this object.
|
public ElGamalParameters()
ELGamalParameters
object.
Applications shall use one of the AlgorithmParameter.getInstance
factory methods for obtaining ElGamalParameters.protected byte[] engineGetEncoded() throws java.io.IOException
A SEQUENCE
ASN.1 object is created for holding prime modulus p
,
base generator g
, and - if available - length l
of the private
value x; subsequently this SEQUENCE object is DER encoded to get the required byte array.
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.
Only calls engineGetEncoded()
for returning the ElGamal parameters as DER encoded byte array, 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
engineGetParameterSpec
in class java.security.AlgorithmParametersSpi
paramSpec
- the desired parameter specification classjava.security.spec.InvalidParameterSpecException
- if the parameters cannot be
converted to the desired parameter specificationprotected void engineInit(java.security.spec.AlgorithmParameterSpec paramSpec) throws java.security.spec.InvalidParameterSpecException
p
, base generator g
and
length l
of the private value x, derived from the given ElGamalParameterSpec.engineInit
in class java.security.AlgorithmParametersSpi
paramSpec
- the parameter specification, which has to be a ElGamalParameterSpecjava.security.spec.InvalidParameterSpecException
- if the given parameter specification is not a ElGamalParameterSpecprotected void engineInit(byte[] params) throws java.io.IOException
From the given byte array an ASN.1 object is created to be parsed for the
required prime modulus p
, base generator g
and
- if included - length l
of the private value x.
engineInit
in class java.security.AlgorithmParametersSpi
params
- the DER encoded byte arrayjava.io.IOException
- if an error occurs when decoding the given byte arrayprotected void engineInit(byte[] params, java.lang.String format) throws java.io.IOException
Only calls engineInit(params)
for initializing this
ElGamalParameters 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 arraypublic int hashCode()
hashCode
in class java.lang.Object
protected java.lang.String engineToString()
engineToString
in class java.security.AlgorithmParametersSpi