public class RSAPssSaltParameterSpec extends PKCS1AlgorithmParameterSpec
According PKCS#1v2.1
RSASSA-PSS
parameters consist of
hash algorithm id, mask generation function id, salt length and trailer
field:
RSASSA-PSS-params :: = SEQUENCE { hashAlgorithm [0] HashAlgorithm DEFAULT sha1, maskGenerationAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1, saltLength [2] INTEGER DEFAULT 20, trailerField [3] TrailerField DEFAULT trailerFieldBC } HashAlgorithm ::= Algorithmidentifier { {OAEP-PSSDigestAlgorithms} } MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} } TrailerField ::= INTEGER { trailerFieldBC(1) }The Java Cryptography Architecture, however, only allows to set the salt length as parameter and specifies all the other parameters by the algorithm standard name to be implemented by a corresponding PSS signature engine: A signature engine that implements the, for instance, "SHA1withRSAandMGF1" (in general: <digest>with<encryption>and<mgf>) PSS signature algorithm has to use SHA-1 as hash- and MGF1 as mask generation algorithm. The trailer field (0xBC) is fixed by the PKCS#1v2.1 standard and the salt length may be supplied as parameter (default 20 for the SHA-1 hash algorithm).
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SALT_LENGTH
Default salt length (20).
|
protected byte[] |
salt_
The salt value; if set by the application.
|
protected int |
saltLength_
Salt length.
|
Constructor and Description |
---|
RSAPssSaltParameterSpec()
Creates a RSAPssSaltParameterSpec with the default salt length value (20).
|
RSAPssSaltParameterSpec(byte[] salt)
Creates a RSAPssSaltParameterSpec for the given salt value.
|
RSAPssSaltParameterSpec(int saltLength)
Creates a RSAPssSaltParameterSpec for the given salt length.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this RSAPssSaltParameterSpec object with the supplied object.
|
byte[] |
getSalt()
Gets the salt value, if set by the application.
|
int |
getSaltLength()
Gets the salt length.
|
int |
hashCode()
Gets a hash code for this object.
|
java.lang.String |
toString()
Gets a String representation of this RSAPssSaltParameterSpec.
|
getSecureRandom, setSecureRandom
public static final int DEFAULT_SALT_LENGTH
protected int saltLength_
protected byte[] salt_
public RSAPssSaltParameterSpec()
public RSAPssSaltParameterSpec(int saltLength)
saltLength
- the salt length value to be used.java.lang.IllegalArgumentException
- if saltLength < 0public RSAPssSaltParameterSpec(byte[] salt)
salt
- the salt value to be used (will be not cloned)java.lang.NullPointerException
- if the salt value is nullpublic int getSaltLength()
public byte[] getSalt()
null
if not set by the applicationpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to be comparedtrue
if the two objects are RSAPssSaltParameterSpec
objects with same salt length and -- if set -- salt values;
false
otherwisepublic java.lang.String toString()
toString
in class java.lang.Object