RsaShaSigpublic final class RsaShaSig extends Signature Implements RSA SHA1 Signatures. |
Fields Summary |
---|
private static final byte[] | PREFIX_SHA1Expected prefix in decrypted value when SHA-1 hash is used
with RSA signing. This prefix is followed by the SHA hash. | RSASig | rsaSigCommon signature class. |
Constructors Summary |
---|
public RsaShaSig()Constructs an RSA signature object that uses SHA1 as
message digest algorithm.
try {
rsaSig =
new RSASig(PREFIX_SHA1, MessageDigest.getInstance("SHA-1"));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Needed algorithm not available");
}
|
Methods Summary |
---|
public java.lang.String | getAlgorithm()Gets the signature algorithm.
return "SHA1withRSA";
| 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);
|
|