|
|||||||||
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-sales@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 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 byte array holding the corresponding signature value:
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
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 Object |
engineGetParameter(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(String param,
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, 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 |
Constructor Detail |
public SSLRSASignature() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no implementation for MD5 or SHAMethod Detail |
protected void engineInitVerify(PublicKey pk) throws InvalidKeyException
engineInitVerify
in class SignatureSpi
publicKey
- the RSA public key belonging to the RSA private key that has been used for signing.InvalidKeyException
- if a key encoding error occursprotected void engineInitSign(PrivateKey pk) throws InvalidKeyException
engineInitSign
in class SignatureSpi
privateKey
- the RSA private key to be used for signing.InvalidKeyException
- if a key encoding error occursprotected 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.
engineSign
in class SignatureSpi
SignatureException
- if an error occurs when creating the signatureprotected 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.
engineVerify
in class SignatureSpi
sigBytes
- the signature bytes to be verifiedtrue
if signature is OK, false
if notSignatureException
- if an error occurs when verifying the signatureprotected void engineUpdate(byte b)
engineUpdate
in class SignatureSpi
b
- the byte to update.protected void engineUpdate(byte[] b, int off, int len)
engineUpdate
in class SignatureSpi
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(String param, Object value) throws InvalidParameterException
engineSetParameter
in class SignatureSpi
InvalidParameterException
- This Method is not supportedprotected Object engineGetParameter(String param) throws InvalidParameterException
engineGetParameter
in class SignatureSpi
InvalidParameterException
- This Method is not supported
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |