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

JCEMapper

public class JCEMapper extends Object
This class maps algorithm identifier URIs to JAVA JCE class names.
author
$Author: raul $

Fields Summary
static Logger
log
{@link java.util.logging} logging facility
private static Map
uriToJCEName
private static Map
algorithmsMap
private static String
providerName
Constructors Summary
Methods Summary
public static java.lang.StringgetAlgorithmClassFromURI(java.lang.String AlgorithmURI)
Method getAlgorithmClassFromURI NOTE(Raul Benito) It seems a buggy function the loop doesn't do anything??

param
AlgorithmURI
return
the class name that implements this algorithm

       if (true)
           if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI);

       return ((Algorithm) algorithmsMap.get(AlgorithmURI)).algorithmClass;
   
static com.sun.org.apache.xml.internal.security.algorithms.JCEMapper$AlgorithmgetAlgorithmMapping(java.lang.String algoURI)

   	   return ((Algorithm)algorithmsMap.get(algoURI));
   
public static java.lang.StringgetJCEKeyAlgorithmFromURI(java.lang.String AlgorithmURI)
Method getJCEKeyAlgorithmFromURI

param
AlgorithmURI
return
The KeyAlgorithm for the given URI.


        return  ((Algorithm) algorithmsMap.get(AlgorithmURI)).requiredKey;

   
public static intgetKeyLengthFromURI(java.lang.String AlgorithmURI)
Returns the keylength in bit for a particular algorithm.

param
AlgorithmURI
return
The length of the key used in the alogrithm

       return Integer.parseInt(((Algorithm) algorithmsMap.get(AlgorithmURI)).keyLength);
   
public static java.lang.StringgetProviderId()
Gets the default Provider for obtaining the security algorithms

return
the default providerId.

   		return providerName;
   
public static voidinit(org.w3c.dom.Element mappingElement)
Method init

param
mappingElement
throws
Exception

             
          

      loadAlgorithms((Element)mappingElement.getElementsByTagName("Algorithms").item(0));
   
static voidloadAlgorithms(org.w3c.dom.Element algorithmsEl)

       Element[] algorithms = XMLUtils.selectNodes(algorithmsEl.getFirstChild(),Init.CONF_NS,"Algorithm");
       for (int i = 0 ;i < algorithms.length ;i ++) {
           Element el = algorithms[i];
           String id = el.getAttribute("URI");
           String jceName = el.getAttribute("JCEName");
           uriToJCEName.put(id, jceName);
           algorithmsMap.put(id, new Algorithm(el));
       }
   
public static voidsetProviderId(java.lang.String provider)
Sets the default Provider for obtaining the security algorithms

param
provider the default providerId.

   		providerName=provider;
   
public static java.lang.StringtranslateURItoJCEID(java.lang.String AlgorithmURI)
Method translateURItoJCEID

param
AlgorithmURI
return
the JCE standard name corresponding to the given URI

      if (true)
          if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Request for URI " + AlgorithmURI);

      String jceName = (String) uriToJCEName.get(AlgorithmURI);
      return jceName;