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.AlgorithmParametersSpiok
-
-
Field Summary
Fields Modifier and Type Field and Description protected static java.security.spec.PSSParameterSpecdefaultPSSSpecDefault PSSParameterSpec for FIPS.protected com.ibm.security.x509.AlgorithmIdhashAlgorithmprotected com.ibm.security.x509.AlgorithmIdmaskGenAlgorithmprotected java.security.spec.AlgorithmParameterSpecmgfParameterSpecprotected intsaltLengthprotected inttrailerField
-
Constructor Summary
Constructors Constructor and Description PSSParameters()
-
Method Summary
Methods Modifier and Type Method and Description protected java.security.spec.PSSParameterSpecdecodePSSParameters(byte[] encodedPSSParameters)Decode the asn.1 sequence Check for sequences and parse through each sequence.protected com.ibm.security.util.DerValueencodeHashAlg(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.DerValueencodeMaskGenAlg(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.DerValueencodeMgfParameterSpec(java.security.spec.AlgorithmParameterSpec mgfParameterSpec)encode MGF'1 digest UNIVERSAL_CONSTRUCTRED_SEQUENCE UNIVERSAL_PRIMITIVE_OBJECT_ID UNIVERSAL_PRIMITIVE_NULLprotected com.ibm.security.util.DerValueencodeSalt(int salt)Encodes non default salt lengthprotected com.ibm.security.util.DerValueencodeTrailerField(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.AlgorithmParameterSpecengineGetParameterSpec(java.lang.Class paramSpec)Return the parameter spec used by this parameter instance.protected voidengineInit(java.security.spec.AlgorithmParameterSpec paramSpec)Initialize the PSSParameters by a PSSParameterSpecprotected voidengineInit(byte[] params)Initialize the PSSParameters by encoded bytesprotected voidengineInit(byte[] params, java.lang.String format)Initialize the PSSParameters by encoded bytes with the specified decoding method.protected java.lang.StringengineToString()protected static java.security.AlgorithmParametersgetAlgorithmParameters(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.InvalidParameterSpecExceptionInitialize the PSSParameters by a PSSParameterSpec- Specified by:
engineInitin 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.IOExceptionInitialize the PSSParameters by encoded bytes- Specified by:
engineInitin 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.IOExceptionInitialize the PSSParameters by encoded bytes with the specified decoding method.- Specified by:
engineInitin 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.IOExceptionReturns 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:
engineGetEncodedin 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.IOExceptionEncodes 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.IOExceptionEncodes 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.IOExceptionEncodes 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.IOExceptionUNIVERSAL_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.IOExceptionencode 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.IOExceptionDecode 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.IOExceptionReturns the parameters in encoded bytes with encoding method specified.- Specified by:
engineGetEncodedin 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.InvalidParameterSpecExceptionReturn the parameter spec used by this parameter instance.- Specified by:
engineGetParameterSpecin 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:
engineToStringin classjava.security.AlgorithmParametersSpi
-
getAlgorithmParameters
protected static java.security.AlgorithmParameters getAlgorithmParameters(java.security.spec.PSSParameterSpec spec) throws java.security.InvalidKeyException, java.security.spec.InvalidParameterSpecExceptionGet Algorithmic parameters- Parameters:
spec-- Returns:
- Throws:
java.security.InvalidKeyExceptionjava.security.spec.InvalidParameterSpecException
-
-