public class RsaPssParameterSpec extends java.lang.Object implements java.security.spec.AlgorithmParameterSpec, ASN1Type
The RSA-PSS algorithm is parameterized by choice of hash function, mask generation function, and salt length. These options should be fixed for a given RSA key, except that the salt length can be variable.
This class is designed for use specifically with Entrust's RSA-PSS signature algorithm implementation; it will not work with other vendors RSASAA-PSS algorithm implementations.
--
-- AlgorithmIdentifier.parameters for id-RSASSA-PSS.
-- Note that the tags in this Sequence are explicit.
--
RSASSA-PSS-params ::= SEQUENCE {
hashAlgorithm [0] HashAlgorithm DEFAULT sha1,
maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1,
saltLength [2] INTEGER DEFAULT 20,
trailerField [3] TrailerField DEFAULT trailerFieldBC
}
HashAlgorithm ::= AlgorithmIdentifier { {OAEP-PSSDigestAlgorithms} }
--
-- Allowed EME-OAEP and EMSA-PSS digest algorithms.
--
OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-sha1 PARAMETERS NULL }|
{ OID id-sha256 PARAMETERS NULL }|
{ OID id-sha384 PARAMETERS NULL }|
{ OID id-sha512 PARAMETERS NULL },
... -- Allows for future expansion --
}
MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} }
--
-- Allowed mask generation function algorithms.
-- If the identifier is id-mgf1, the parameters are a HashAlgorithm.
--
PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-mgf1 PARAMETERS HashAlgorithm },
... -- Allows for future expansion --
}
TrailerField ::= INTEGER { trailerFieldBC(1) }
sha1 HashAlgorithm ::= {
algorithm id-sha1,
parameters SHA1Parameters : NULL
}
--
-- Default AlgorithmIdentifier for id-RSAES-OAEP.maskGenAlgorithm and
-- id-RSASSA-PSS.maskGenAlgorithm.
--
mgf1SHA1 MaskGenAlgorithm ::= {
algorithm id-mgf1,
parameters HashAlgorithm : sha1
}
RsaPssSignature,
RsaPssParameters| Constructor and Description |
|---|
RsaPssParameterSpec()
Creates a new instance of
RSAPSSParameterSpec that
contains all null parameter values. |
RsaPssParameterSpec(AlgorithmID hashAlgorithm)
Creates a new instance of
RSAPSSParameterSpec using the
provided algorithm parameter values. |
RsaPssParameterSpec(AlgorithmID hashAlgorithm,
AlgorithmID maskGenAlgorithm,
java.lang.Integer saltLength,
java.lang.Integer trailerField)
Creates a new instance of
RSAPSSParameterSpec using the
provided algorithm parameter values. |
RsaPssParameterSpec(ASN1Object obj)
Creates an
RSAPSSParameterSpec object from an
ASN1Object. |
| Modifier and Type | Method and Description |
|---|---|
void |
decode(ASN1Object obj)
Decodes an
RSAPSSParameterSpec object from an
ASN1Object. |
AlgorithmID |
getHashAlgorithm()
Returns the hash algorithm identifier.
|
AlgorithmID |
getMaskGenAlgorithm()
Returns the mask generation function algorithm identifier.
|
int |
getSaltLength()
Gets the octet length (length in bytes) of the salt.
|
int |
getTrailerField()
Gets the trailer field number.
|
ASN1Object |
toASN1Object()
Encodes this
RSAPSSParameterSpec object as an
ASN1Object. |
java.lang.String |
toString()
Creates a text representation of the ASN.1 structure of this
RSAPSSParameterSpec object. |
public RsaPssParameterSpec()
RSAPSSParameterSpec that
contains all null parameter values.
This indicates default algorithm parameter values are to be used; the following are the default for each parameter value:
sha1: {OID id-sha1 PARAMETERS NULL}mgf1SHA1: {OID id-mgf1 PARAMETERS sha1}201public RsaPssParameterSpec(AlgorithmID hashAlgorithm)
RSAPSSParameterSpec using the
provided algorithm parameter values.
The following algorithm parameter values are used:
{OID id-mgf1 PARAMETERS hashAlgorithm}1
If a hash algorithm is not provided, the following default value is to be
used sha1: {OID id-sha1 PARAMETERS NULL}.
hashAlgorithm - the hash algorithm identifier (OPTIONAL)java.lang.IllegalArgumentException - if the provided hash algorithm parameter value is not
supportedpublic RsaPssParameterSpec(AlgorithmID hashAlgorithm, AlgorithmID maskGenAlgorithm, java.lang.Integer saltLength, java.lang.Integer trailerField)
RSAPSSParameterSpec using the
provided algorithm parameter values.
All the algorithm parameters are optional, and if missing default value are to be used; the following are the default for each parameter value:
sha1: {OID id-sha1 PARAMETERS NULL}mgf1SHA1: {OID id-mgf1 PARAMETERS sha1}1hashAlgorithm - the hash algorithm identifier (OPTIONAL)maskGenAlgorithm - the mask generation function algorithm identifier (OPTIONAL)saltLength - the salt length (OPTIONAL)trailerField - the trailer field (OPTIONAL)java.lang.IllegalArgumentException - if any of the provided algorithm parameter values are not
supportedpublic RsaPssParameterSpec(ASN1Object obj) throws CodingException
RSAPSSParameterSpec object from an
ASN1Object.
The ASN1Object must be a RSASS-PSS-params structure.
obj - an ASN.1 representation of an RSASS-PSS-params structureCodingException - thrown if an errors occurs while decoding the
ANS1Objectpublic AlgorithmID getHashAlgorithm()
If the hash algorithm has not been set, the default hash algorithm
sha1: {OID id-sha1 PARAMETERS NULL} is returned instead.
The following hash algorithms are supported:
OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-sha1 PARAMETERS NULL }|
{ OID id-sha256 PARAMETERS NULL }|
{ OID id-sha384 PARAMETERS NULL }|
{ OID id-sha512 PARAMETERS NULL },
... -- Allows for future expansion --
}
public AlgorithmID getMaskGenAlgorithm()
If the mask generation function algorithm has not been set, the default
mask generation function algorithm
mgf1SHA1: {OID id-mgf1 PARAMETERS sha1} is returned
instead. The following mask generation function algorithms are supported:
PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-mgf1 PARAMETERS HashAlgorithm },
... -- Allows for future expansion --
}
HashAlgorithm ::= AlgorithmIdentifier { {OAEP-PSSDigestAlgorithms} }
OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-sha1 PARAMETERS NULL }|
{ OID id-sha256 PARAMETERS NULL }|
{ OID id-sha384 PARAMETERS NULL }|
{ OID id-sha512 PARAMETERS NULL },
... -- Allows for future expansion --
}
public int getSaltLength()
If the salt length has not been set, the default salt length
20 is returned instead.
public int getTrailerField()
If the trailer field number has not been set, the default trailer field
number 1 is returned instead.
public ASN1Object toASN1Object()
RSAPSSParameterSpec object as an
ASN1Object.toASN1Object in interface ASN1Typepublic void decode(ASN1Object obj) throws CodingException
RSAPSSParameterSpec object from an
ASN1Object.
The ASN1Object must be a RSASS-PSS-params structure.
decode in interface ASN1Typeobj - an ASN.1 representation of an RSASS-PSS-params structureCodingException - thrown if an errors occurs while decoding the
ANS1Objectpublic java.lang.String toString()
RSAPSSParameterSpec object.toString in class java.lang.Object