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.


Variable Index

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

Method Index

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

Variables

 o 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.

 o 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.

Methods

 o size
 public static int size()
Return the number of installed algorithms.

 o algorithms
 public static Enumeration algorithms()
Return an enumeration of the URL names of the currently installed algorithms.

 o printAlgorithms
 public static void printAlgorithms()
Print the list of currently installed hashing algorithms and the names of the classes that implement them on stdout.

 o 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).

 o isInstalled
 public static boolean isInstalled(String name)
Find out if the specified algorithm is installed in the registry.

 o 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.

 o 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.
 o 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