Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.security.Identity

java.lang.Object
    |
    +----java.security.Identity
Subclasses:
IdentityScope, Signer

public class Identity
extends Object
implements Principal, Serializable

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.

See Also:
IdentityScope, Signer, Principal

Constructor Summary
 Identity()
Constructor for serialization only.
 Identity(String name, IdentityScope scope)
Constructs an identity with the specified name and scope.
 Identity(String name)
Constructs an identity with the specified name and no scope.
 Identity(String name, String info, Certificate[] certificates, PublicKey publicKey)
Constructs an identity with the specified name, info, certificates, and public key.
 

Method Summary
void  addCertificate(Certificate certificate)
Adds a certificate for this identity. Deprecated
void  addCertificate(Certificate certificate)
Adds a certificate for this identity. Deprecated
Certificate[]  certificates()
Returns a copy of all the certificates for this identity. Deprecated
boolean  equals(Object identity)
Tests for equality between the specified object and this identity.
Certificate[]  getCertificates()
Returns a copy of all the certificates for this identity.
String  getInfo()
Returns general information previously specified for this identity.
String  getName()
Returns this identity's name.
PublicKey  getPublicKey()
Returns this identity's public key.
IdentityScope  getScope()
Returns this identity's scope.
int  hashCode()
Returns a hashcode for this identity.
boolean  identityEquals(Identity identity)
Tests for equality between the specified identity and this identity.
void  removeCertificate(Certificate certificate)
Removes a certificate from this identity. Deprecated
void  removeCertificate(Certificate certificate)
Removes a certificate from this identity. Deprecated
void  setInfo(String info)
Specifies a general information string for this identity.
void  setPublicKey(PublicKey key)
Sets this identity's public key.
String  toString()
Returns a short string describing this identity, telling its name and its scope (if any).
String  toString(boolean detailed)
Returns a string representation of this identity, with optionally more details than that provided by the toString method without any arguments.
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Identity

protected Identity()
Constructor for serialization only.

Identity

public Identity(String name,
                IdentityScope scope) throws KeyManagementException
Constructs an identity with the specified name and scope.
Parameters:
name - the identity name.
scope - the scope of the identity.
Throws:
KeyManagementException - if there is already an identity with the same name in the scope.

Identity

public Identity(String name)
Constructs an identity with the specified name and no scope.
Parameters:
name - the identity name.

Identity

public Identity(String name,
                String info,
                Certificate[] certificates,
                PublicKey publicKey)
Constructs an identity with the specified name, info, certificates, and public key.
Parameters:
name - the identity name.
info - the information string.
publicKey - the public key for this identity.
certificates - the certificates to be added.
Method Detail

getName

public final String getName()
Returns this identity's name.
Implements:
getName in interface Principal
Returns:
the name of this identity.

getScope

public final IdentityScope getScope()
Returns this identity's scope.
Returns:
the scope of this identity.

getPublicKey

public PublicKey getPublicKey()
Returns this identity's public key.
Returns:
the public key for this identity.

setPublicKey

public void setPublicKey(PublicKey key) throws KeyManagementException
Sets this identity's public key. The old key and all of this identity's certificates are removed by this operation.
Parameters:
key - the public key for this identity.
Throws:
KeyManagementException - if another identity in the identity's scope has the same public key, or if another exception occurs.

setInfo

public void setInfo(String info)
Specifies a general information string for this identity.
Parameters:
info - the information string.
See Also:
getInfo

getInfo

public String getInfo()
Returns general information previously specified for this identity.
Returns:
general information about this identity.
See Also:
setInfo

addCertificate

public void addCertificate(Certificate certificate) throws KeyManagementException
Note: addCertificate() is deprecated.Use the new addCertificate method instead.

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

addCertificate

public void addCertificate(Certificate certificate) throws KeyManagementException
Note: addCertificate() is deprecated.Use the new addCertificate method instead.

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

removeCertificate

public void removeCertificate(Certificate certificate) throws KeyManagementException
Note: removeCertificate() is deprecated.Use the new removeCertificate method instead.

Removes a certificate from this identity.
Parameters:
certificate - the certificate to be removed.
Throws:
KeyManagementException - if the certificate is missing, or if another exception occurs.

removeCertificate

public void removeCertificate(Certificate certificate) throws KeyManagementException
Note: removeCertificate() is deprecated.Use the new removeCertificate method instead.

Removes a certificate from this identity.
Parameters:
certificate - the certificate to be removed.
Throws:
KeyManagementException - if the certificate is missing, or if another exception occurs.

certificates

public Certificate[] certificates()
Note: certificates() is deprecated.Use getCertificates instead.

Returns a copy of all the certificates for this identity.
Returns:
a copy of all the certificates for this identity.

getCertificates

public Certificate[] getCertificates()
Returns a copy of all the certificates for this identity.
Returns:
a copy of all the certificates for this identity.

equals

public final boolean equals(Object identity)
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.
Implements:
equals in interface Principal
Parameters:
identity - the object to test for equality with this identity.
Returns:
true if the objects are considered equal, false otherwise.
Overrides:
equals in class Object
See Also:
identityEquals

identityEquals

protected boolean identityEquals(Identity identity)
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.
Parameters:
identity - the identity to test for equality with this identity.
Returns:
true if the identities are considered equal, false otherwise.
See Also:
equals

toString

public String toString()
Returns a short string describing this identity, telling its name and its scope (if any).
Implements:
toString in interface Principal
Returns:
information about this identity, such as its name and the name of its scope (if any).
Overrides:
toString in class Object

toString

public String toString(boolean detailed)
Returns a string representation of this identity, with optionally more details than that provided by the toString method without any arguments.
Implements:
toString in interface Principal
Parameters:
detailed - whether or not to provide detailed information.
Returns:
information about this identity. If detailed is true, then this method returns more information than that provided by the toString method without any arguments.
See Also:
toString

hashCode

public int hashCode()
Returns a hashcode for this identity.
Implements:
hashCode in interface Principal
Returns:
a hashcode for this identity.
Overrides:
hashCode in class Object

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.