    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.www.dsig.CertDatabase

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

public final class CertDatabase
extends Object

This class implements a simple database of identity certificates mapping names to certificates. It can be used to retrieve all available certificates for an individual with a given name. Certificates follow the standard java.security.Certificate API.

This class cannot be instantiated, all of its methods are static. Extension mechanisms that allow to replace the simple base class by one that indeed queries a database are yet to be designed.

##

addCert(Certificate)
  Add a certificate to the database.
certForName(Principal)
  Return all certificates for the named individual.
certForName(Principal, int)
  Return the certificate at position index for the given individual.
certForName(String)
  Return all certificates for the named individual.
certForName(String, int)
  Return the certificate at position index for the given individual.
certificates()
  Return an Enumeration of the names of all individuals in the database.
printDatabase()
  Print the names of each individual in the database and the number certificate each of them has.
removeCert(Certificate)
  Remove a certificate from the database.
removeCert(Principal, int)
  Removes the certificate at position index for the invidual name from the database.
removeCert(String, int)
  Removes the certificate at position index for the invidual name from the database.
reset()
  Reset the database.

##

reset

     public static void reset()

  Reset the database. It will contain no certificates after this method is invoked. Mainly for debugging purposes.

printDatabase

     public static void printDatabase()

  Print the names of each individual in the database and the number certificate each of them has.

addCert

     public static boolean addCert(Certificate cert)

  Add a certificate to the database. Return true if the certificate was successfully added or false otherwise (i.e. it was already present).

removeCert

     public static void removeCert(String name,
                                   int index) throws ArrayIndexOutOfBoundsException

  Removes the certificate at position index for the invidual name from the database.

  Throws: ArrayIndexOutOfBoundsException
    if the specified certficate does not exist.

removeCert

     public static void removeCert(Principal pr,
                                   int index) throws ArrayIndexOutOfBoundsException

  Removes the certificate at position index for the invidual name from the database. Shorthand for `removeCert(pr.getName(), index);`

  Throws: ArrayIndexOutOfBoundsException
    if the specified certficate does not exist.

removeCert

     public static boolean removeCert(Certificate cert)

  Remove a certificate from the database. Return true if it is was successfully removed, false otherwise (i.e. certificate was not present in the database).

certificates

     public static Enumeration certificates()

  Return an Enumeration of the names of all individuals in the database.

certForName

     public static Certificate[] certForName(String name)

  Return all certificates for the named individual. If no certificates are available, this returns an array of size 0.

certForName

     public static Certificate[] certForName(Principal pr)

  Return all certificates for the named individual. Shorthand for `certForName(pr.getName())`

certForName

     public static Certificate certForName(String name,
                                           int index) throws ArrayIndexOutOfBoundsException

  Return the certificate at position index for the given individual.

  Throws: ArrayIndexOutOfBoundsException
    if the given index is not valid.

certForName

     public static Certificate certForName(Principal pr,
                                           int index) throws ArrayIndexOutOfBoundsException

  Return the certificate at position index for the given individual. Shorthand for `certForName(pr.getName(), index)`.

  Throws: ArrayIndexOutOfBoundsException
    if the given index is not valid.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index