Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
gnu.java.security.sig.rsa.EMSA_PSS
EMSA-PSS coincides with EMSA4 in IEEE P1363a D5 except that EMSA-PSS acts on octet strings and not on bit strings. In particular, the bit lengths of the hash and the salt must be multiples of 8 in EMSA-PSS. Moreover, EMSA4 outputs an integer of a desired bit length rather than an octet string.
EMSA-PSS is parameterized by the choice of hash function Hash and mask generation function MGF. In this submission, MGF is based on a Hash definition that coincides with the corresponding definitions in IEEE Std 1363-2000, PKCS #1 v2.0, and the draft ANSI X9.44. In PKCS #1 v2.0 and the draft ANSI X9.44, the recommended hash function is SHA-1, while IEEE Std 1363-2000 recommends SHA-1 and RIPEMD-160.
References:
Method Summary | |
Object |
|
boolean |
|
byte[] |
|
static EMSA_PSS |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public Object clone()
This method may be called to create a new copy of the Object. The typical behavior is as follows:
o == o.clone()
is falseo.getClass() == o.clone().getClass()
is trueo.equals(o)
is trueHowever, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override
Object.equals(Object)
.If the Object you call clone() on does not implement
Cloneable
(which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
- Returns:
- a copy of the Object
- See Also:
Cloneable
public boolean decode(byte[] mHash, byte[] EM, int emBits, int sLen)
The decoding operation EMSA-PSS-Decode recovers the message hash from an encoded messageEM
and compares it to the hash ofM
.
- Parameters:
mHash
- the byte sequence resulting from applying the message digest algorithm Hash to the message M.EM
- the encoded message, an octet string of lengthemLen = CEILING(emBits/8).
emBits
- the maximal bit length of the integer OS2IP(EM), at least8.hLen + 8.sLen + 9
.sLen
- the length, in octets, of the expected salt.
- Returns:
true
if the result of the verification was consistent with the expected reseult; andfalse
if the result was inconsistent.
- Throws:
IllegalArgumentException
- if an exception occurs.
public byte[] encode(byte[] mHash, int emBits, byte[] salt)
The encoding operation EMSA-PSS-Encode computes the hash of a messageM
using a hash function and maps the result to an encoded messageEM
of a specified length using a mask generation function.
- Parameters:
mHash
- the byte sequence resulting from applying the message digest algorithm Hash to the message M.emBits
- the maximal bit length of the integer OS2IP(EM), at least8.hLen + 8.sLen + 9
.salt
- the salt to use when encoding the output.
- Returns:
- the encoded message
EM
, an octet string of lengthemLen = CEILING(emBits / 8)
.
- Throws:
IllegalArgumentException
- if an exception occurs.
public static EMSA_PSS getInstance(String mdName)
Returns an instance of this object given a designated name of a hash function.
- Parameters:
mdName
- the canonical name of a hash function.
- Returns:
- an instance of this object configured for use with the designated options.