RsaMd5Sigpublic final class RsaMd5Sig extends Signature Implements RSA MD5 Signatures. |
Fields Summary |
---|
private static final byte[] | PREFIX_MD5Expected prefix in the decrypted result when MD5 hashing is used
with RSA signing. This prefix is followed by the MD5 hash.
If you are interested, more details are in the comments around
the verify method in X509Certificate. | RSASig | rsaSigCommon signature class. |
Constructors Summary |
---|
public RsaMd5Sig()Constructs an RSA signature object that uses MD5 as
message digest algorithm.
try {
rsaSig = new RSASig(PREFIX_MD5, MessageDigest.getInstance("MD5"));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Needed algorithm not available");
}
|
Methods Summary |
---|
public java.lang.String | getAlgorithm()Gets the signature algorithm.
return "MD5withRSA";
| public int | getLength()Gets the byte-length of the signature.
return rsaSig.getLength();
| public void | initSign(PrivateKey theKey)Initializes the RSASig object with the appropriate
Key for signature creation.
rsaSig.initSign(theKey);
| public void | initVerify(PublicKey theKey)Initializes the RSASig object with the appropriate
Key for signature verification.
rsaSig.initVerify(theKey);
| public int | sign(byte[] sigBuf, int sigOff, int sigLen)Generates the signature of all/last input data. A call to this
method also resets this signature object to the state it was in
when previously initialized via a call to init(). That is, the
object is reset and available to sign another message.
return rsaSig.sign(sigBuf, sigOff, sigLen);
| public void | update(byte[] inBuf, int inOff, int inLen)Accumulates a signature of the input data. When this method is used,
temporary storage of intermediate results is required. This method
should only be used if all the input data required for the signature
is not available in one byte array. The sign() or verify() method is
recommended whenever possible.
rsaSig.update(inBuf, inOff, inLen);
| public boolean | verify(byte[] sigBuf, int sigOff, int sigLen)Verifies the signature of all/last input data against the passed
in signature. A call to this method also resets this signature
object to the state it was in when previously initialized via a
call to init(). That is, the object is reset and available to
verify another message.
return rsaSig.verify(sigBuf, sigOff, sigLen);
|
|