au.net.aba.crypto.provider
Class MD5withRSA

java.lang.Object
  |
  +--java.security.SignatureSpi
        |
        +--java.security.Signature
              |
              +--au.net.aba.crypto.provider.MD5withRSA

public class MD5withRSA
extends java.security.Signature

This algorithm implements the Signature algorithm of "MD5 with RSA" as defined in PKCS#1. The algorithm returns an ecnrypted block containing an ASN.1 DigestInfo structure.

 AlgorithmIdentifier ::= SEQUENCE {
    algorithm   OBJECT IDENTIFIER,
    parameters  ANY DEFINED BY algorithm OPTIONAL
 }
 
 DigestInfo ::= SEQUENCE {
   digestAlgorithm DigestAlgorithmIdentifier,
   digest Digest }
 
 digestAlgorithmIdentifier ::= AlgorithmIdentifier
 
 Digest ::= OCTET STRING
 
 id-md5 OBJECT IDENTIFIER ::= { 1 2 840 113549 2 5 }
 md5Identifier :== AlgorithmIdentifier { id-md5, NULL }
 


Fields inherited from class java.security.Signature
SIGN, state, UNINITIALIZED, VERIFY
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
MD5withRSA()
           
 
Method Summary
protected  java.lang.Object engineGetParameter(java.lang.String param)
          This algorithm does not support parameters.
protected  void engineInitSign(java.security.PrivateKey privateKey)
          Initializes this signature object with the specified private key for signing operations.
protected  void engineInitVerify(java.security.PublicKey publicKey)
          Initializes this signature object with the specified public key for verification operations.
protected  void engineSetParameter(java.lang.String param, java.lang.Object value)
          This algorithm does not support parameters.
protected  byte[] engineSign()
          Returns the signature block for all the data update so far.
protected  void engineUpdate(byte b)
          Updates the data to be signed or verified using the specified byte.
protected  void engineUpdate(byte[] b, int off, int len)
          Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
protected  boolean engineVerify(byte[] sigBytes)
          Verifies the passed-in signature.
 
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
 

Constructor Detail

MD5withRSA

public MD5withRSA()
Method Detail

engineInitVerify

protected void engineInitVerify(java.security.PublicKey publicKey)
                         throws java.security.InvalidKeyException
Initializes this signature object with the specified public key for verification operations.
Parameters:
publicKey - the public key of the identity whose signature is going to be verified.
Throws:
java.security.InvalidKeyException - if the key is improperly encoded, parameters are missing, and so on.
Overrides:
engineInitVerify in class java.security.SignatureSpi

engineInitSign

protected void engineInitSign(java.security.PrivateKey privateKey)
                       throws java.security.InvalidKeyException
Initializes this signature object with the specified private key for signing operations.
Parameters:
privateKey - the private key of the identity whose signature will be generated.
Throws:
java.security.InvalidKeyException - if the key is improperly encoded, parameters are missing, and so on.
Overrides:
engineInitSign in class java.security.SignatureSpi

engineUpdate

protected void engineUpdate(byte b)
                     throws java.security.SignatureException
Updates the data to be signed or verified using the specified byte.
Parameters:
b - the byte to use for the update.
Throws:
java.security.SignatureException - if the engine is not initialized properly.
Overrides:
engineUpdate in class java.security.SignatureSpi

engineUpdate

protected void engineUpdate(byte[] b,
                            int off,
                            int len)
                     throws java.security.SignatureException
Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
Parameters:
data - the array of bytes.
off - the offset to start from in the array of bytes.
len - the number of bytes to use, starting at offset.
Throws:
java.security.SignatureException - if the engine is not initialized properly.
Overrides:
engineUpdate in class java.security.SignatureSpi

engineSign

protected byte[] engineSign()
                     throws java.security.SignatureException
Returns the signature block for all the data update so far. This block is a PKCS#1 encrypted block of a BER encoded ASN.1 DigestInfo block.
Returns:
the signature bytes of the signing operation's result.
Throws:
java.security.SignatureException - if the engine is not initialized properly.
Overrides:
engineSign in class java.security.SignatureSpi

engineVerify

protected boolean engineVerify(byte[] sigBytes)
                        throws java.security.SignatureException
Verifies the passed-in signature. The signature block is an RSA encrypted block containing a DER encoded ASN.1 DigestInfo structure.
Returns:
true if the signature was verfied, false if not.
Overrides:
engineVerify in class java.security.SignatureSpi

engineSetParameter

protected void engineSetParameter(java.lang.String param,
                                  java.lang.Object value)
                           throws java.security.InvalidParameterException
This algorithm does not support parameters. This method will throw an exception to indicate so.
Overrides:
engineSetParameter in class java.security.SignatureSpi

engineGetParameter

protected java.lang.Object engineGetParameter(java.lang.String param)
                                       throws java.security.InvalidParameterException
This algorithm does not support parameters. This method will throw an exception to indicate so.
Overrides:
engineGetParameter in class java.security.SignatureSpi