FileDocCategorySizeDatePackage
SignatureBaseRSA.javaAPI DocJava SE 6 API10652Tue Jun 10 00:23:00 BST 2008com.sun.org.apache.xml.internal.security.algorithms.implementations

SignatureBaseRSA

public abstract class SignatureBaseRSA extends SignatureAlgorithmSpi
author
$Author: raul $

Fields Summary
static Logger
log
{@link java.util.logging} logging facility
private Signature
_signatureAlgorithm
Field algorithm
Constructors Summary
public SignatureBaseRSA()
Constructor SignatureRSA

throws
XMLSignatureException


           
       

      String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());

      if (true)
      	if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
      String provider=JCEMapper.getProviderId();
      try {
      	 if (provider==null) {
      	 	this._signatureAlgorithm = Signature.getInstance(algorithmID);
      	 } else {
      	 	this._signatureAlgorithm = Signature.getInstance(algorithmID,provider);
      	 }
      } catch (java.security.NoSuchAlgorithmException ex) {
         Object[] exArgs = { algorithmID,
                             ex.getLocalizedMessage() };

         throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
      } catch (NoSuchProviderException ex) {
      	 Object[] exArgs = { algorithmID,
      	 					 ex.getLocalizedMessage() };

      	 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
	}
   
Methods Summary
protected java.lang.StringengineGetJCEAlgorithmString()

inheritDoc

      return this._signatureAlgorithm.getAlgorithm();
   
protected java.lang.StringengineGetJCEProviderName()

inheritDoc

      return this._signatureAlgorithm.getProvider().getName();
   
public abstract java.lang.StringengineGetURI()

inheritDoc

protected voidengineInitSign(java.security.Key signingKey, java.security.spec.AlgorithmParameterSpec algorithmParameterSpec)

inheritDoc

      throw new XMLSignatureException(
         "algorithms.CannotUseAlgorithmParameterSpecOnRSA");
   
protected voidengineInitSign(java.security.Key privateKey, java.security.SecureRandom secureRandom)

inheritDoc


      if (!(privateKey instanceof PrivateKey)) {
         String supplied = privateKey.getClass().getName();
         String needed = PrivateKey.class.getName();
         Object exArgs[] = { supplied, needed };

         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
                                         exArgs);
      }

      try {
         this._signatureAlgorithm.initSign((PrivateKey) privateKey,
                                           secureRandom);
      } catch (InvalidKeyException ex) {
         throw new XMLSignatureException("empty", ex);
      }
   
protected voidengineInitSign(java.security.Key privateKey)

inheritDoc


      if (!(privateKey instanceof PrivateKey)) {
         String supplied = privateKey.getClass().getName();
         String needed = PrivateKey.class.getName();
         Object exArgs[] = { supplied, needed };

         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
                                         exArgs);
      }

      try {
         this._signatureAlgorithm.initSign((PrivateKey) privateKey);
      } catch (InvalidKeyException ex) {
         throw new XMLSignatureException("empty", ex);
      }
   
protected voidengineInitVerify(java.security.Key publicKey)

inheritDoc


      if (!(publicKey instanceof PublicKey)) {
         String supplied = publicKey.getClass().getName();
         String needed = PublicKey.class.getName();
         Object exArgs[] = { supplied, needed };

         throw new XMLSignatureException("algorithms.WrongKeyForThisOperation",
                                         exArgs);
      }

      try {
         this._signatureAlgorithm.initVerify((PublicKey) publicKey);
      } catch (InvalidKeyException ex) {
         throw new XMLSignatureException("empty", ex);
      }
   
protected voidengineSetHMACOutputLength(int HMACOutputLength)

inheritDoc

      throw new XMLSignatureException("algorithms.HMACOutputLengthOnlyForHMAC");
   
protected voidengineSetParameter(java.security.spec.AlgorithmParameterSpec params)

inheritDoc


      try {
         this._signatureAlgorithm.setParameter(params);
      } catch (InvalidAlgorithmParameterException ex) {
         throw new XMLSignatureException("empty", ex);
      }
   
protected byte[]engineSign()

inheritDoc


      try {
         return this._signatureAlgorithm.sign();
      } catch (SignatureException ex) {
         throw new XMLSignatureException("empty", ex);
      }
   
protected voidengineUpdate(byte input)

inheritDoc


      try {
         this._signatureAlgorithm.update(input);
      } catch (SignatureException ex) {
         throw new XMLSignatureException("empty", ex);
      }
   
protected voidengineUpdate(byte[] buf, int offset, int len)

inheritDoc


      try {
         this._signatureAlgorithm.update(buf, offset, len);
      } catch (SignatureException ex) {
         throw new XMLSignatureException("empty", ex);
      }
   
protected voidengineUpdate(byte[] input)

inheritDoc


      try {
         this._signatureAlgorithm.update(input);
      } catch (SignatureException ex) {
         throw new XMLSignatureException("empty", ex);
      }
   
protected booleanengineVerify(byte[] signature)

inheritDoc


      try {
         return this._signatureAlgorithm.verify(signature);
      } catch (SignatureException ex) {
         throw new XMLSignatureException("empty", ex);
      }