java.security
Class Identity

java.lang.Object
  extended by java.security.Identity
All Implemented Interfaces:
Serializable, Principal
Direct Known Subclasses:
IdentityScope, Signer

Deprecated. Replaced by java.security.KeyStore, the java.security.cert package, and java.security.Principal.

public abstract class Identity
extends Object
implements Principal, Serializable

The Identity class is used to represent people and companies that can be authenticated using public key encryption. The identities can also be abstract objects such as smart cards.

Identity objects store a name and public key for each identity. The names cannot be changed and the identities can be scoped. Each identity (name and public key) within a scope are unique to that scope.

Each identity has a set of ceritificates which all specify the same public key, but not necessarily the same name.

The Identity class can be subclassed to allow additional information to be attached to it.

See Also:
IdentityScope, Signer, Principal, Serialized Form

Constructor Summary
protected Identity()
          Deprecated. Constructor for serialization only.
  Identity(String name)
          Deprecated. Constructs a new instance of Identity with the specified name and no scope.
  Identity(String name, IdentityScope scope)
          Deprecated. Constructs a new instance of Identity with the specified name and scope.
 
Method Summary
 void addCertificate(Certificate certificate)
          Deprecated. Adds a certificate to the list of ceritificates for this identity.
 Certificate[] certificates()
          Deprecated.  
 boolean equals(Object identity)
          Deprecated. Checks for equality between this Identity and a specified object.
 String getInfo()
          Deprecated.  
 String getName()
          Deprecated. This method returns a String that names this Principal.
 PublicKey getPublicKey()
          Deprecated.  
 IdentityScope getScope()
          Deprecated.  
 int hashCode()
          Deprecated. Get a value that represents this Object, as uniquely as possible within the confines of an int.
protected  boolean identityEquals(Identity identity)
          Deprecated. Checks for equality between this Identity and a specified object.
 void removeCertificate(Certificate certificate)
          Deprecated. Removes a certificate from the list of ceritificates for this identity.
 void setInfo(String info)
          Deprecated. Sets the general information string.
 void setPublicKey(PublicKey key)
          Deprecated. Sets the public key for this identity.
 String toString()
          Deprecated. Returns a string representation of this Identity.
 String toString(boolean detailed)
          Deprecated. Returns a detailed string representation of this Identity.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Identity

protected Identity()
Deprecated. 
Constructor for serialization only.


Identity

public Identity(String name,
                IdentityScope scope)
         throws KeyManagementException
Deprecated. 
Constructs a new instance of Identity with the specified name and scope.

Parameters:
name - the name to use.
scope - the scope to use.
Throws:
KeyManagementException - if the identity is already present.

Identity

public Identity(String name)
Deprecated. 
Constructs a new instance of Identity with the specified name and no scope.

Parameters:
name - the name to use.
Method Detail

getName

public final String getName()
Deprecated. 
Description copied from interface: Principal
This method returns a String that names this Principal.

Specified by:
getName in interface Principal
Returns:
the name of this identity.

getScope

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

getPublicKey

public PublicKey getPublicKey()
Deprecated. 
Returns:
the public key of this identity.
See Also:
setPublicKey(java.security.PublicKey)

setPublicKey

public void setPublicKey(PublicKey key)
                  throws KeyManagementException
Deprecated. 
Sets the public key for this identity. The old key and all certificates are removed.

Parameters:
key - the public key to use.
Throws:
KeyManagementException - if this public key is used by another identity in the current scope.
SecurityException - if a SecurityManager is installed which disallows this operation.

setInfo

public void setInfo(String info)
Deprecated. 
Sets the general information string.

Parameters:
info - the general information string.
Throws:
SecurityException - if a SecurityManager is installed which disallows this operation.

getInfo

public String getInfo()
Deprecated. 
Returns:
the general information string of this identity.
See Also:
setInfo(String)

addCertificate

public void addCertificate(Certificate certificate)
                    throws KeyManagementException
Deprecated. 
Adds a certificate to the list of ceritificates for this identity. The public key in this certificate must match the existing public key if it exists.

Parameters:
certificate - the certificate to add.
Throws:
KeyManagementException - if the certificate is invalid, or the public key conflicts.
SecurityException - if a SecurityManager is installed which disallows this operation.

removeCertificate

public void removeCertificate(Certificate certificate)
                       throws KeyManagementException
Deprecated. 
Removes a certificate from the list of ceritificates for this identity.

Parameters:
certificate - the certificate to remove.
Throws:
KeyManagementException - if the certificate is invalid.
SecurityException - if a SecurityManager is installed which disallows this operation.

certificates

public Certificate[] certificates()
Deprecated. 
Returns:
an array of Certificates for this identity.

equals

public final boolean equals(Object identity)
Deprecated. 
Checks for equality between this Identity and a specified object. It first checks if they are the same object, then if the name and scope match and returns true if successful. If these tests fail, the identityEquals(Identity) method is called.

Specified by:
equals in interface Principal
Overrides:
equals in class Object
Parameters:
identity - the Object to compare to
Returns:
true if they are equal, false otherwise.
See Also:
Object.hashCode()

identityEquals

protected boolean identityEquals(Identity identity)
Deprecated. 
Checks for equality between this Identity and a specified object. A subclass should override this method. The default behavior is to return true if the public key and names match.

Returns:
true if they are equal, false otherwise.

toString

public String toString()
Deprecated. 
Returns a string representation of this Identity.

Specified by:
toString in interface Principal
Overrides:
toString in class Object
Returns:
a string representation of this Identity.
Throws:
SecurityException - if a SecurityManager is installed which disallows this operation.
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)

toString

public String toString(boolean detailed)
Deprecated. 
Returns a detailed string representation of this Identity.

Parameters:
detailed - indicates whether or detailed information is desired.
Returns:
a string representation of this Identity.
Throws:
SecurityException - if a SecurityManager is installed which disallows this operation.

hashCode

public int hashCode()
Deprecated. 
Description copied from class: Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

Notice that since hashCode is used in Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
Returns:
a hashcode of this identity.
See Also:
Object.equals(Object), System.identityHashCode(Object)