|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.vt.middleware.crypt.AbstractAlgorithm
edu.vt.middleware.crypt.signature.SignatureAlgorithm
edu.vt.middleware.crypt.signature.RSASignature
public class RSASignature
Implements the RSASSA-PKCS1-v1_5 signature algorithm described in http://www.ietf.org/rfc/rfc2437.txt.
| Field Summary |
|---|
| Fields inherited from class edu.vt.middleware.crypt.signature.SignatureAlgorithm |
|---|
digest, signKey, verifyKey |
| Fields inherited from class edu.vt.middleware.crypt.AbstractAlgorithm |
|---|
algorithm, logger, randomByteSize, randomProvider |
| Constructor Summary | |
|---|---|
RSASignature()
Creates a new RSA signature class that uses a SHA-1 for message digest computation. |
|
RSASignature(DigestAlgorithm d)
Creates a new RSA signature class that uses the given digest algorithm for message digest computation. |
|
| Method Summary | |
|---|---|
protected void |
chunkUpdate(InputStream in)
Update the signer in chunks with data read from the input stream. |
protected void |
init(boolean forSigning,
org.bouncycastle.crypto.CipherParameters params)
Initialize the signer. |
void |
initSign()
Initialize the signature for the SignatureAlgorithm.sign(byte[]) operation. |
void |
initVerify()
Initialize the signature for the SignatureAlgorithm.verify(byte[], byte[]) operation. |
void |
setSignKey(PrivateKey key)
Sets the private key used for signing. |
void |
setVerifyKey(PublicKey key)
Sets the public key used for verification. |
byte[] |
sign(byte[] data)
Signs the given data and returns the signature as a byte array. |
byte[] |
sign(InputStream in)
Computes the signature of the data in the given input stream by processing in chunks. |
boolean |
verify(byte[] data,
byte[] signature)
Verifies the signature of the given data matches the given signature. |
boolean |
verify(InputStream in,
byte[] signature)
Verifies the signature of the given data matches the given signature. |
| Methods inherited from class edu.vt.middleware.crypt.signature.SignatureAlgorithm |
|---|
clone, newInstance, newInstance, sign, sign, verify, verify |
| Methods inherited from class edu.vt.middleware.crypt.AbstractAlgorithm |
|---|
getAlgorithm, getRandomData, setRandomProvider, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RSASignature()
public RSASignature(DigestAlgorithm d)
d - Message digest algorithm.| Method Detail |
|---|
public void setSignKey(PrivateKey key)
setSignKey in class SignatureAlgorithmkey - Private key.public void setVerifyKey(PublicKey key)
setVerifyKey in class SignatureAlgorithmkey - Public key.public void initSign()
SignatureAlgorithm.sign(byte[]) operation.
initSign in class SignatureAlgorithmpublic void initVerify()
SignatureAlgorithm.verify(byte[], byte[]) operation.
initVerify in class SignatureAlgorithm
public byte[] sign(byte[] data)
throws CryptException
sign in class SignatureAlgorithmdata - Data to be signed.
CryptException - On signature failure.
public byte[] sign(InputStream in)
throws CryptException,
IOException
sign in class SignatureAlgorithmin - Input stream containing data to be signed.
CryptException - On signature failure.
IOException - On input stream read errors.
public boolean verify(byte[] data,
byte[] signature)
throws CryptException
verify in class SignatureAlgorithmdata - Data to be verified.signature - Signature to be used for comparison.
CryptException - On verification failure.
public boolean verify(InputStream in,
byte[] signature)
throws CryptException,
IOException
verify in class SignatureAlgorithmin - Input stream containing data to be verified.signature - Signature to be used for comparison.
CryptException - On verification failure.
IOException - On input stream read errors.
protected void init(boolean forSigning,
org.bouncycastle.crypto.CipherParameters params)
forSigning - Whether to initialize signer for the sign operation.params - BC cipher parameters.
protected void chunkUpdate(InputStream in)
throws IOException
in - Input stream to read from.
IOException - On IO errors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||