|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.security.SignatureSpi
|
+--java.security.Signature
|
+--iaik.security.rsa.SSLRSASignature
THIS CLASS IS OUTDATED AND SHOULD NOT BE USED ANY LONGER. It was originally written for use by the iSaSiLk library, but it is not used for this purpose any longer. It will probably be removed in a future release, if you still need it please contact jce-info@iaik.at.
This class implements a special form of a RSA Signature as used within the Secure Sockets Layer (SSL v3.0) protocol.
SSL handles digital signatures by either using the Digital Signature Algorithm (DSA) or a RSA based method. This class implements the RSA version od SSL digital signing, where the SHA and MD5 hash algorithms are used to form 36-byte structure, which subsequently is signed (encrypted with the RSA private key).
In contrast to Md5RSASignature and ShaRSASignature
this class not only calls the superclass constructor specifying the hash
algorithm to be used. This class overrides all the methods of the superclass
according to the particular signature requirements of the SSLv3 protocol.
The general proceeding for signing a message (e.g. build up of
client_hello_random + server_hello_random + params) or verifying
a signature follows the common guidelines prescribing three steps
to be performed:
getInstance method, e.g.:
Signature ssl_rsa = Signature.getInstance("SSL/RSA");
ssl_rsa.initSign(rsaPrivateKey);
ssl_rsa.initVerify(rsaPublicKey);
sign method returning the signature as DER encoded byte array.
Otherwise, if the Signature object has been initialized for verifying, first the
data to be verified is supplied to the Signature object, and subsequently the
signature is verified by calling the verify method, supplied with
the DER encoded byte array holding the corresponding signature:
ssl_rsa.update(data); byte[] signature = ssl_rsa.sign();
ssl_rsa.update(data);
System.out.println("Signature " + (ssl_rsa.verify(signature) ? "correct!" : "not correct!"));
RSASignature,
ShaRSASignature,
Md5RSASignature,
Signature,
Md5,
SHA| Field Summary | |
protected MessageDigest |
md5
The first message digest used to MD5-based hash the data. |
protected MessageDigest |
sha
The second message digest used to SHA-based hash the data. |
| Fields inherited from class java.security.Signature |
SIGN,
state,
UNINITIALIZED,
VERIFY |
| Fields inherited from class java.security.SignatureSpi |
appRandom |
| Constructor Summary | |
SSLRSASignature()
The default constructor. |
|
| Method Summary | |
protected java.lang.Object |
engineGetParameter(java.lang.String param)
This method is not implemented and only throws an InvalidParameterException |
protected void |
engineInitSign(PrivateKey pk)
SPI: Initializes this signature object with the given RSA private key for going to sign some data. |
protected void |
engineInitVerify(PublicKey pk)
SPI: Initializes this signature object with the given RSA public key for performing a signature verification. |
protected void |
engineSetParameter(java.lang.String param,
java.lang.Object value)
This method is not implemented and only throws an InvalidParameterException |
protected byte[] |
engineSign()
SPI: Returns a byte array holding the signature resulting from all already performed data update operations. |
protected void |
engineUpdate(byte b)
SPI: Updates the data to be signed or verified with the specified byte. |
protected void |
engineUpdate(byte[] b,
int off,
int len)
SPI: Updates the data to be signed or verified with the specified number of bytes, beginning at the specified offset within the given byte array. |
protected boolean |
engineVerify(byte[] sigBytes)
Verifies the given signature of a message according to SSL v3.0. |
| Methods inherited from class java.security.Signature |
clone,
getAlgorithm,
getInstance,
getInstance,
getParameter,
getProvider,
initSign,
initSign,
initVerify,
setParameter,
setParameter,
sign,
sign,
toString,
update,
update,
update,
verify |
| Methods inherited from class java.security.SignatureSpi |
engineInitSign,
engineSetParameter,
engineSign |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected MessageDigest md5
protected MessageDigest sha
| Constructor Detail |
public SSLRSASignature()
throws NoSuchAlgorithmException
| Method Detail |
protected void engineInitVerify(PublicKey pk)
throws InvalidKeyException
publicKey - the RSA public key belonging to the RSA private key that has been used for signing.
protected void engineInitSign(PrivateKey pk)
throws InvalidKeyException
privateKey - the RSA private key to be used for signing.
protected byte[] engineSign()
throws SignatureException
According to SSLv3 the data is digested with both Md5 and SHA algorithms before encrypting the result using the RSA algorithm with PKCS#1 padding.
protected boolean engineVerify(byte[] sigBytes)
throws SignatureException
According to SSLv3 the data is digested with both Md5 and SHA algorithms before decrypting it using the RSA algorithm.
sigBytes - the signature bytes to be verifiedtrue if signature is OK, false if notprotected void engineUpdate(byte b)
b - the byte to update.
protected void engineUpdate(byte[] b,
int off,
int len)
data - the byte array holding the data to be used for this update operation.off - the offset, indicating the start position within the given byte array.len - the number of bytes to be obtained from the given byte array, starting at the given position.
protected void engineSetParameter(java.lang.String param,
java.lang.Object value)
throws InvalidParameterException
protected java.lang.Object engineGetParameter(java.lang.String param)
throws InvalidParameterException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||