    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.crypto.us.dsig.SigSuiteRSA

    java.lang.Object
       |
       +----w3c.www.dsig.SignatureSuite
               |
               +----w3c.crypto.us.dsig.SigSuiteRSA

public abstract class SigSuiteRSA
extends SignatureSuite

Generic DSig Signature Suite for suites using the RSA signature algorithm and the conventions like those defined for RSA/MD5 and RSA/SHA1 in the DSig signature suite specifications. This class cannot be used directly, it needs to be subclassed for each particular hashing algorithm to be used. The subclass only needs to implemement a public constructor with no arguments that calls `super(String suiteURL, String shortname, MessageDigest hash)` where `hash` is an instance of the message digest algorithm to be used, and shortname be either RSAMD5 or RSASHA1.

Note: the implementation of RSA algorithm is provided by RSA Security Inc. (JSAFE COM.rsa.jsafe Java package). Therefore, you need to have the JSAFE package in order for this class (and others) to run properly.

See Also:
  SigSuiteRSASHA1, SigSuiteRSAMD5

##

SigSuiteRSA(String, String, MessageDigest)
  Constructor for use by its subclasses.

##

getBy()
  Return the By information itself.
getByType()
  Return the type of the By information given in this signature suite.
getKeyLength()
  Returns the key length of the RSA key used.
setBy(String, Object)
  Set the By information for this signature suite to the type type and the value to signer.
sign(DSigLabelInterface, PrivateKey)
  Sign the given label using the given private key, which needs to be an instance of w3c.crypto.us.dsig.RSAPrivateKeyImpl.
verify(DSigLabelInterface, PublicKey)
  Verify if this signature suite object correctly signs the given label with the given public key.

##

SigSuiteRSA

     protected SigSuiteRSA(String suiteURL,
                           String shortName,
                           MessageDigest hash)

  Constructor for use by its subclasses. `suiteURL` is the URL of the SigSuite. `shortname` is the short name of the URL. `hash` is the message digest algorithm used to hash to label before signing for verification of RSA is performed.

##

getKeyLength

     public int getKeyLength()

  Returns the key length of the RSA key used. Returns -1 if no key has been initialized.

  Overrides:
    getKeyLength in class SignatureSuite

verify

     public Trivalue verify(DSigLabelInterface label,
                            PublicKey pubkey)

  Verify if this signature suite object correctly signs the given label with the given public key. pubkey must either be an instance of w3c.crypto.us.dsig.RSAPublicKeyImpl or null. In that case the public key will be extracted from the signature suite if it is specified either as ByKey or as ByName (trying a certificate lookup). If no valid public key can be found, verify returns unknown. Else the signature will be verified using that public key returning unknown if there was any other problem verifying the signature or one of true/ false to indicate the result.

  Overrides:
    verify in class SignatureSuite
  See Also:
    RSAPublicKeyImpl

sign

     public DSigLabelInterface sign(DSigLabelInterface label,
                                    PrivateKey privkey)

  Sign the given label using the given private key, which needs to be an instance of w3c.crypto.us.dsig.RSAPrivateKeyImpl. Signing automatically sets the ByName property to "[anonymous]", that should be set appropriately after signing. If this signature suite object already contains a signature, it will be replaced by the new one.

  Overrides:
    sign in class SignatureSuite
  See Also:
    RSAPrivateKeyImpl

setBy

     public SignatureSuite setBy(String type,
                                 Object signer)

  Set the By information for this signature suite to the type type and the value to signer. Supported by this signature suite are "ByName", which uses signer.toString() as the value; and "ByKey" and "ByHash", in which cases signer has to be an instance of DSAPublicKey. The method returns this signature suite itself for success or null if there was an error. NOTE: This method has to be called after signing in order to have any effect.

  Overrides:
    setBy in class SignatureSuite

getByType

     public String getByType()

  Return the type of the By information given in this signature suite. This will return either one of the string "ByName", "ByKey", or "ByHash" or null.

  Overrides:
    getByType in class SignatureSuite

getBy

     public Object getBy()

  Return the By information itself. For ByName, this will return the name as string, for ByKey it will return the name as a DSAPublicKey, and for ByHash it will return the hash data as a byte array. In case of any error or if no known by information was found this method return null.

  Overrides:
    getBy in class SignatureSuite

    All Packages  Class Hierarchy  This Package  Previous  Next  Index