com.ibm.crypto.fips.provider
Class PSSParameters
- java.lang.Object
-
- java.security.AlgorithmParametersSpi
-
- com.ibm.crypto.fips.provider.PSSParameters
-
public final class PSSParameters extends java.security.AlgorithmParametersSpi
ok
-
-
Field Summary
Fields Modifier and Type Field and Description protected static java.security.spec.PSSParameterSpec
defaultPSSSpec
Default PSSParameterSpec for FIPS.protected com.ibm.security.x509.AlgorithmId
hashAlgorithm
protected com.ibm.security.x509.AlgorithmId
maskGenAlgorithm
protected java.security.spec.AlgorithmParameterSpec
mgfParameterSpec
protected int
saltLength
protected int
trailerField
-
Constructor Summary
Constructors Constructor and Description PSSParameters()
-
Method Summary
Methods Modifier and Type Method and Description protected java.security.spec.PSSParameterSpec
decodePSSParameters(byte[] encodedPSSParameters)
Decode the asn.1 sequence Check for sequences and parse through each sequence.protected com.ibm.security.util.DerValue
encodeHashAlg(com.ibm.security.x509.AlgorithmId hashAlgorithm)
Encodes hash algorithm CONTEXT_CONSTRUCTED_0 UNIVERSAL_CONSTRUCTED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULLprotected com.ibm.security.util.DerValue
encodeMaskGenAlg(com.ibm.security.x509.AlgorithmId maskGenAlgorithm, java.security.spec.AlgorithmParameterSpec mgf1ParameterSpec)
UNIVERSAL_CONSTRUCTED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_CONSTRUCTRED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULL Encode MaskGenrationfunction and the digest algorithm used by mgf1protected com.ibm.security.util.DerValue
encodeMgfParameterSpec(java.security.spec.AlgorithmParameterSpec mgfParameterSpec)
encode MGF'1 digest UNIVERSAL_CONSTRUCTRED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULLprotected com.ibm.security.util.DerValue
encodeSalt(int salt)
Encodes non default salt lengthprotected com.ibm.security.util.DerValue
encodeTrailerField(int trailerField)
Encodes non default TrailerFieldprotected byte[]
engineGetEncoded()
Returns the parameters in encoded bytes.protected byte[]
engineGetEncoded(java.lang.String encodingMethod)
Returns the parameters in encoded bytes with encoding method specified.protected java.security.spec.AlgorithmParameterSpec
engineGetParameterSpec(java.lang.Class paramSpec)
Return the parameter spec used by this parameter instance.protected void
engineInit(java.security.spec.AlgorithmParameterSpec paramSpec)
Initialize the PSSParameters by a PSSParameterSpecprotected void
engineInit(byte[] params)
Initialize the PSSParameters by encoded bytesprotected void
engineInit(byte[] params, java.lang.String format)
Initialize the PSSParameters by encoded bytes with the specified decoding method.protected java.lang.String
engineToString()
protected static java.security.AlgorithmParameters
getAlgorithmParameters(java.security.spec.PSSParameterSpec spec)
Get Algorithmic parameters
-
-
-
Field Detail
-
hashAlgorithm
protected com.ibm.security.x509.AlgorithmId hashAlgorithm
-
maskGenAlgorithm
protected com.ibm.security.x509.AlgorithmId maskGenAlgorithm
-
mgfParameterSpec
protected java.security.spec.AlgorithmParameterSpec mgfParameterSpec
-
saltLength
protected int saltLength
-
trailerField
protected int trailerField
-
defaultPSSSpec
protected static final java.security.spec.PSSParameterSpec defaultPSSSpec
Default PSSParameterSpec for FIPS. For encoding/decoding, PSSParameterSpec.DEFAULT is still used for interoperability.
-
-
Method Detail
-
engineInit
protected void engineInit(java.security.spec.AlgorithmParameterSpec paramSpec) throws java.security.spec.InvalidParameterSpecException
Initialize the PSSParameters by a PSSParameterSpec- Specified by:
engineInit
in classjava.security.AlgorithmParametersSpi
- Parameters:
paramSpec
- the RSAPSS algorithm parameter spec for this instance.- Throws:
java.security.spec.InvalidParameterSpecException
-
engineInit
protected void engineInit(byte[] params) throws java.io.IOException
Initialize the PSSParameters by encoded bytes- Specified by:
engineInit
in classjava.security.AlgorithmParametersSpi
- Parameters:
params
- the encoded bytes of the parameters.- Throws:
java.io.IOException
-
engineInit
protected void engineInit(byte[] params, java.lang.String format) throws java.io.IOException
Initialize the PSSParameters by encoded bytes with the specified decoding method.- Specified by:
engineInit
in classjava.security.AlgorithmParametersSpi
- Parameters:
params
- the encoded bytes of the parameters.format
- the decoding method to be used.- Throws:
java.io.IOException
-
engineGetEncoded
protected byte[] engineGetEncoded() throws java.io.IOException
Returns the parameters in encoded bytes. Only non default values will be encoded. With a single non default value, the encoding for hash looks as follows; CONTEXT_CONSTRUCTED_0 UNIVERSAL_CONSTRUCTED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULL CONTEXT_CONSTRUCTED_1 UNIVERSAL_CONSTRUCTED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_CONSTRUCTRED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULL CONTEXT_CONSTRUCTED_2 UNIVERSAL_PRIMITIVE_INTEGER CONTEXT_CONSTRUCTED_3 UNIVERSAL_PRIMITIVE_INTEGER- Specified by:
engineGetEncoded
in classjava.security.AlgorithmParametersSpi
- Returns:
- byte[] the encoded parameters
- Throws:
java.io.IOException
-
encodeSalt
protected com.ibm.security.util.DerValue encodeSalt(int salt) throws java.io.IOException
Encodes non default salt length- Parameters:
salt
-- Returns:
- Throws:
java.io.IOException
- CONTEXT_CONSTRUCTED_2 UNIVERSAL PRIMARY INTEGER
-
encodeTrailerField
protected com.ibm.security.util.DerValue encodeTrailerField(int trailerField) throws java.io.IOException
Encodes non default TrailerField- Parameters:
trailerField
-- Returns:
- Throws:
java.io.IOException
- CONTEXT_CONSTRUCTED_3 UNIVERSAL PRIMARY INTEGER
-
encodeHashAlg
protected com.ibm.security.util.DerValue encodeHashAlg(com.ibm.security.x509.AlgorithmId hashAlgorithm) throws java.io.IOException
Encodes hash algorithm CONTEXT_CONSTRUCTED_0 UNIVERSAL_CONSTRUCTED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULL- Parameters:
hashAlgorithm
-- Returns:
- Throws:
java.io.IOException
-
encodeMaskGenAlg
protected com.ibm.security.util.DerValue encodeMaskGenAlg(com.ibm.security.x509.AlgorithmId maskGenAlgorithm, java.security.spec.AlgorithmParameterSpec mgf1ParameterSpec) throws java.io.IOException
UNIVERSAL_CONSTRUCTED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_CONSTRUCTRED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULL Encode MaskGenrationfunction and the digest algorithm used by mgf1- Parameters:
maskGenAlgorithm
-mgf1ParameterSpec
-- Returns:
- Throws:
java.io.IOException
-
encodeMgfParameterSpec
protected com.ibm.security.util.DerValue encodeMgfParameterSpec(java.security.spec.AlgorithmParameterSpec mgfParameterSpec) throws java.io.IOException
encode MGF'1 digest UNIVERSAL_CONSTRUCTRED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULL- Returns:
- Throws:
java.io.IOException
-
decodePSSParameters
protected java.security.spec.PSSParameterSpec decodePSSParameters(byte[] encodedPSSParameters) throws java.io.IOException
Decode the asn.1 sequence Check for sequences and parse through each sequence.- Parameters:
encodedPSSParameters
-- Returns:
- Throws:
java.io.IOException
- * Only non default values will be encoded. With a single non default value, the encoding for hash looks as follows; CONTEXT_CONSTRUCTED_0 UNIVERSAL_CONSTRUCTED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULL CONTEXT_CONSTRUCTED_1 UNIVERSAL_CONSTRUCTED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_CONSTRUCTRED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULL CONTEXT_CONSTRUCTED_2 UNIVERSAL_PRIMITIVE_INTEGER CONTEXT_CONSTRUCTED_3 UNIVERSAL_PRIMITIVE_INTEGERjava.security.NoSuchAlgorithmException
-
engineGetEncoded
protected byte[] engineGetEncoded(java.lang.String encodingMethod) throws java.io.IOException
Returns the parameters in encoded bytes with encoding method specified.- Specified by:
engineGetEncoded
in classjava.security.AlgorithmParametersSpi
- Returns:
- byte[] encoded parameters.
- Throws:
java.io.IOException
-
engineGetParameterSpec
protected java.security.spec.AlgorithmParameterSpec engineGetParameterSpec(java.lang.Class paramSpec) throws java.security.spec.InvalidParameterSpecException
Return the parameter spec used by this parameter instance.- Specified by:
engineGetParameterSpec
in classjava.security.AlgorithmParametersSpi
- Parameters:
paramSpec
- the parameter spec class to be returned- Returns:
- AlgorithmParameterSpec the newly generated parameterSpec
- Throws:
java.security.spec.InvalidParameterSpecException
-
engineToString
protected java.lang.String engineToString()
- Specified by:
engineToString
in classjava.security.AlgorithmParametersSpi
-
getAlgorithmParameters
protected static java.security.AlgorithmParameters getAlgorithmParameters(java.security.spec.PSSParameterSpec spec) throws java.security.InvalidKeyException, java.security.spec.InvalidParameterSpecException
Get Algorithmic parameters- Parameters:
spec
-- Returns:
- Throws:
java.security.InvalidKeyException
java.security.spec.InvalidParameterSpecException
-
-