This class represents identities: real-world objects such as people,
companies or organizations whose identities can be authenticated using
their public keys. Identities may also be more abstract (or concrete)
constructs, such as daemon threads or smart cards.

All Identity objects have a name and a public key. Names are
immutable. Identities may also be scoped. That is, if an Identity is
specified to have a particular scope, then the name and public
key of the Identity are unique within that scope.

An Identity also has a set of certificates (all certifying its own
public key). The Principal names specified in these certificates need
not be the same, only the key.

An Identity can be subclassed, to include postal and email addresses,
telephone numbers, images of faces and logos, and so on.

addCertificate

Adds a certificate for this identity. If the identity has a public
key, the public key in the certificate must be the same, and if
the identity does not have a public key, the identity's
public key is set to be that specified in the certificate.

First, if there is a security manager, its checkSecurityAccess
method is called with "addIdentityCertificate"
as its argument to see if it's ok to add a certificate.

Parameters:

certificate - the certificate to be added.

Throws:

KeyManagementException - if the certificate is not valid,
if the public key in the certificate being added conflicts with
this identity's public key, or if another exception occurs.

SecurityException - if a security manager exists and its
checkSecurityAccess method doesn't allow
adding a certificate.

equals

Tests for equality between the specified object and this identity.
This first tests to see if the entities actually refer to the same
object, in which case it returns true. Next, it checks to see if
the entities have the same name and the same scope. If they do,
the method returns true. Otherwise, it calls
identityEquals, which subclasses should
override.

identityEquals

Tests for equality between the specified identity and this identity.
This method should be overriden by subclasses to test for equality.
The default behavior is to return true if the names and public keys
are equal.