| java.lang.Object com.sun.midp.crypto.RSASig
RSASig | final class RSASig (Code) | | Implements RSA Signatures.
|
Constructor Summary | |
| RSASig(byte[] sigPrefix, MessageDigest messageDigest) Constructs an RSA signature object that uses the specified
signature algorithm.
Parameters: sigPrefix - Prefix for the signature Parameters: messageDigest - Message digest for the signature exception: NoSuchAlgorithmException - if RSA isnot available in the caller's environment. |
Method Summary | |
public int | getLength() Gets the byte-length of the signature. | public void | initSign(PrivateKey theKey) Initializes the RSASig object with the appropriate
Key for signature creation. | public void | initVerify(PublicKey theKey) Initializes the RSASig object with the appropriate
Key for signature verification. | public int | sign(byte[] sigBuf, int sigOff, int sigLen) Generates the signature of all/last input data. | public void | update(byte[] inBuf, int inOff, int inLen) Accumulates a signature of the input data. | public boolean | verify(byte[] sigBuf, int sigOff, int sigLen) Verifies the signature of all/last input data against the passed
in signature. |
prefix | byte[] prefix(Code) | | Signature prefix.
|
RSASig | RSASig(byte[] sigPrefix, MessageDigest messageDigest) throws NoSuchAlgorithmException(Code) | | Constructs an RSA signature object that uses the specified
signature algorithm.
Parameters: sigPrefix - Prefix for the signature Parameters: messageDigest - Message digest for the signature exception: NoSuchAlgorithmException - if RSA isnot available in the caller's environment. |
getLength | public int getLength()(Code) | | Gets the byte-length of the signature.
the byte-length of the signature produced by this object |
initSign | public void initSign(PrivateKey theKey) throws InvalidKeyException(Code) | | Initializes the RSASig object with the appropriate
Key for signature creation.
Parameters: theKey - the key object to use for signing exception: InvalidKeyException - if the key type is inconsistent with the mode or signature implementation. |
initVerify | public void initVerify(PublicKey theKey) throws InvalidKeyException(Code) | | Initializes the RSASig object with the appropriate
Key for signature verification.
Parameters: theKey - the key object to use for verification exception: InvalidKeyException - if the key type is inconsistent with the mode or signature implementation. |
sign | public int sign(byte[] sigBuf, int sigOff, int sigLen) throws SignatureException(Code) | | 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.
Parameters: sigBuf - the output buffer to store signature data Parameters: sigOff - starting offset within the output buffer at whichto begin signature data Parameters: sigLen - max byte length of signature data number of bytes of signature output in sigBuf exception: SignatureException - if this signature object is not initialized properly, or len is less than the actual signature |
update | public void update(byte[] inBuf, int inOff, int inLen) throws SignatureException(Code) | | 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.
Parameters: inBuf - the input buffer of data to be signed Parameters: inOff - starting offset within the input buffer for data tobe signed Parameters: inLen - the byte length of data to be signed exception: SignatureException - if this signature object is not initialized properly. |
verify | public boolean verify(byte[] sigBuf, int sigOff, int sigLen) throws SignatureException(Code) | | 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.
Parameters: sigBuf - the input buffer containing signature data Parameters: sigOff - starting offset within the sigBuf where signaturedata begins Parameters: sigLen - byte length of signature data true if signature verifies, false otherwise exception: SignatureException - if this signature object is not initialized properly, or the passed-in signature is improperly encoded or of the wrong type, etc. |
|
|