| java.lang.Object com.sun.portal.kssl.Signature com.sun.portal.kssl.RSASig
RSASig | final class RSASig extends Signature (Code) | | Implements RSA Signatures.
|
Field Summary | |
byte | alg Current algorithm. | Key | k Current key. | MessageDigest | md Current message digest. | byte | mode Current certificate mode. |
Constructor Summary | |
| RSASig(byte a) Constructs an RSA signature object that uses the specified
signature algorithm. |
Method Summary | |
public byte | getAlgorithm() Gets the signature algorithm. | public short | getLength() Gets the byte-length of the signature. | public void | init(Key theKey, byte theMode) Initializes the RSASig object with the appropriate
Key for signature creation or verification. | public void | init(Key theKey, byte theMode, byte[] b, int off, int len) Initializes the RSASig object with the appropriate
Key and algorithm specific parameters for signature
creation or verification. | public short | sign(byte[] inBuf, int inOff, int inLen, byte[] sigBuf, int sigOff) 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[] inBuf, int inOff, int inLen, byte[] sigBuf, int sigOff, short sigLen) Verifies the signature of all/last input data against the passed
in signature. |
alg | byte alg(Code) | | Current algorithm.
|
mode | byte mode(Code) | | Current certificate mode.
|
RSASig | RSASig(byte a)(Code) | | Constructs an RSA signature object that uses the specified
signature algorithm.
Parameters: a - one of ALG_RSA_MD5_PKCS1 or ALG_RSA_SHA_PKCS1 |
getAlgorithm | public byte getAlgorithm()(Code) | | Gets the signature algorithm.
the algorithmimplemented by this signature object |
getLength | public short getLength()(Code) | | Gets the byte-length of the signature.
the byte-length of the signature produced by this object |
init | public void init(Key theKey, byte theMode) throws CryptoException(Code) | | Initializes the RSASig object with the appropriate
Key for signature creation or verification.
Parameters: theKey - the key object to use for signing or verification Parameters: theMode - one of MODE_SIGN or MODE_VERIFY exception: CryptoException - with reason code ILLEGAL_VALUE if an invalid mode is specified or if the key type is inconsistent with the mode or signature implementation. |
init | public void init(Key theKey, byte theMode, byte[] b, int off, int len) throws CryptoException(Code) | | Initializes the RSASig object with the appropriate
Key and algorithm specific parameters for signature
creation or verification.
Parameters: theKey - the key object to use for signing or verification Parameters: theMode - one of MODE_SIGN or MODE_VERIFY Parameters: b - byte array containing algorithm specific parameters Parameters: off - starting offset of parameter data within the byte array Parameters: len - byte length of parameter data exception: CryptoException - with reason code ILLEGAL_VALUE if an invalid mode is specified or if the key type is inconsistent with the mode or signature implementation or if this initialization modeis not supported by the signature algorithm |
sign | public short sign(byte[] inBuf, int inOff, int inLen, byte[] sigBuf, int sigOff) throws CryptoException(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: 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 Parameters: sigBuf - the output buffer to store signature data Parameters: sigOff - starting offset within the output buffer at whichto begin signature data number of bytes of signature output in sigBuf exception: CryptoException - with the following reason codes: (i)UNINITIALIZED_KEY if key is not initialized, (ii)INVALID_INIT if signature object wasn notproperly initialized, for signing (iii) ILLEGAL_USE if the signature algorithm does not pad the message and themessage is not block aligned |
update | public void update(byte[] inBuf, int inOff, int inLen) throws CryptoException(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: CryptoException - with UNINITIALIZED_KEY or INVALID_INIT if the signature objectis not properly initialized See Also: RSASig.verify(byte[],int,int,byte[],int,short) |
verify | public boolean verify(byte[] inBuf, int inOff, int inLen, byte[] sigBuf, int sigOff, short sigLen) throws CryptoException(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: inBuf - the input buffer of data to be verified Parameters: inOff - starting offset within the input buffer for data tobe verified Parameters: inLen - the byte length of data to be verified 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: CryptoException - with the following reason codes: (i)UNINITIALIZED_KEY if key is not initialized, (ii)INVALID_INIT if signature object wasn notproperly initialized, for verification (iii) ILLEGAL_USE if the signature algorithm does not pad the message and themessage is not block aligned |
Methods inherited from com.sun.portal.kssl.Signature | abstract public byte getAlgorithm()(Code)(Java Doc) public static Signature getInstance(byte alg, boolean ext) throws CryptoException(Code)(Java Doc) abstract public short getLength()(Code)(Java Doc) abstract public void init(Key theKey, byte theMode) throws CryptoException(Code)(Java Doc) abstract public void init(Key theKey, byte theMode, byte[] b, int off, int len) throws CryptoException(Code)(Java Doc) abstract public short sign(byte[] inBuf, int inOff, int inLen, byte[] sigBuf, int sigOff) throws CryptoException(Code)(Java Doc) abstract public void update(byte[] inBuf, int inOff, int inLen) throws CryptoException(Code)(Java Doc) abstract public boolean verify(byte[] inBuf, int inOff, int inLen, byte[] sigBuf, int sigOff, short sigLen) throws CryptoException(Code)(Java Doc)
|
|
|