    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.www.dsig.HashRegistry

    java.lang.Object
       |
       +----w3c.www.dsig.HashRegistry

public final class HashRegistry
extends Object

The HashRegistry class maintains a database of the DSig message digest algorithms installed on the system. Classes implementing DSig hash algorithms follow the standard `java.security.MessageDigest` API. The only difference between using this class the querying the java.security API is that classes can be retrieved here via their identifying URLs as defined in the DSig specification, as opposed to their short names via the standard Java Security API.

When this class is loaded, it automatically searches the default Java security provider for the algorithms MD5 and SHA-1 and installs them if they are present (they normally are, as they are part of the Sun provider). Classes in this registry database do not need to be installed as a java.security provider, although they can be and usually will be.

NOTE - Limitations of this class: only one implementation of each algorithm can be in the database at a time.

##

MD5URL
  The URL defined to indentify the MD5 hashing algorithm.
SHA1URL
  The URL defined to indentify the SHA1 hashing algorithm.

##

addAlgorithm(String, Class)
  Add a new hashing algorithm, identified via name, implemented by the class clazz.
algorithms()
  Return an enumeration of the URL names of the currently installed algorithms.
getImplementor(String)
  Return the Class object of the class implementing the algorithm name.
getInstance(String)
  Get an instance of a class implementing the hash algorithm name.
isInstalled(String)
  Find out if the specified algorithm is installed in the registry.
printAlgorithms()
  Print the list of currently installed hashing algorithms and the names of the classes that implement them on stdout.
removeAlgorithm(String)
  Remove the named algorithm from the registry.
size()
  Return the number of installed algorithms.

##

MD5URL

     public static final String MD5URL

  The URL defined to indentify the MD5 hashing algorithm. Currently this is `http://www.w3.org/TR/1998/REC-DSig-label/MD5-1_0`.

SHA1URL

     public static final String SHA1URL

  The URL defined to indentify the SHA1 hashing algorithm. Currently this is `http://www.w3.org/TR/1998/REC-DSig-label/SHA1-1_0`.

##

size

     public static int size()

  Return the number of installed algorithms.

algorithms

     public static Enumeration algorithms()

  Return an enumeration of the URL names of the currently installed algorithms.

printAlgorithms

     public static void printAlgorithms()

  Print the list of currently installed hashing algorithms and the names of the classes that implement them on stdout.

addAlgorithm

     public static boolean addAlgorithm(String name,
                                        Class clazz)

  Add a new hashing algorithm, identified via name, implemented by the class clazz. Returns true is successful, false otherwise (algorithm already present or the class represented by the clazz object does not implement a message digest algorithm).

isInstalled

     public static boolean isInstalled(String name)

  Find out if the specified algorithm is installed in the registry.

removeAlgorithm

     public static boolean removeAlgorithm(String name)

  Remove the named algorithm from the registry. Returns true if successful, false if the algorithm was not installed.

getInstance

     public static MessageDigest getInstance(String name) throws NoSuchAlgorithmException

  Get an instance of a class implementing the hash algorithm name. Name is the URL identifying the algorithm.

  Throws: NoSuchAlgorithmException
    if the algorithm cannot be found.

getImplementor

     public static Class getImplementor(String name) throws NoSuchAlgorithmException

  Return the Class object of the class implementing the algorithm name.

  Throws: NoSuchAlgorithmException
    if the algorithm is not installed.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index