Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.security

Class Identity

java.lang.Object
|
+--java.security.Identity

All Implemented Interfaces:

Principal, Serializable


public abstract class Identity

extends Object

implements Principal, Serializable

The Identity class is used to repsent people and companies that can be authenticated using public key encryption. The identities can also be abstract objects such as smart cards. Identity object 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 is 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.

Since:Author:

Constructor Summary

Identity()

Creates a new instance of Identity from Serialized Data
Identity(java.lang.String name, java.security.IdentityScope scope)

Creates a new instance of Identity with the specified name and IdentityScope.
Identity(java.lang.String name)

Creates a new instance of Identity with the specified name and no scope.

Method Summary

voidaddCertificate(java.security.Certificate certificate)

Adds a certificate to the list of ceritificates for this identity.
java.security.Certificate[]certificates()

Returns an array of certificates for this identity.
booleanequals(java.lang.Object identity)

Checks for equality between this Identity and the specified object.
java.lang.StringgetInfo()

Gets the general information string.
java.lang.StringgetName()

Gets the name for this Identity.
java.security.PublicKeygetPublicKey()

Gets the public key for this identity.
java.security.IdentityScopegetScope()

Gets the scope for this Identity.
inthashCode()

Gets the hashcode for this Identity.
booleanidentityEquals(java.security.Identity identity)

Checks for equality between this Identity and the specified object.
voidremoveCertificate(java.security.Certificate certificate)

Removes a certificate from the list of ceritificates for this identity.
voidsetInfo(java.lang.String info)

Sets the general information string.
voidsetPublicKey(java.security.PublicKey key)

Sets the public key for this identity.
java.lang.StringtoString()

Returns a string representing this Identity.
java.lang.StringtoString(boolean detailed)

Returns a detailed string representing this Identity.

Constructor Details

Identity

protected Identity()

Creates a new instance of Identity from Serialized Data


Identity

public Identity(java.lang.String name)

Creates a new instance of Identity with the specified name and no scope.

Parameters:


Identity

public Identity(java.lang.String name, java.security.IdentityScope scope)

Creates a new instance of Identity with the specified name and IdentityScope.

Parameters:

Throws:


Method Details

addCertificate

public void addCertificate(java.security.Certificate certificate)

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. This class checks the security manager with the call checkSecurityAccess with "addIdentityCertificate".

Parameters:

Throws:


certificates

public Certificate[] certificates()

Returns an array of certificates for this identity.


equals

public final boolean equals(java.lang.Object identity)

Checks for equality between this Identity and the specified object. If first checks if they are the same object, then if the name and scope matches and returns true if successful. If these tests fail, identityEquals is called.

Parameters:

Returns:


getInfo

public String getInfo()

Gets the general information string.

Returns:


getName

public final String getName()

Gets the name for this Identity.

Returns:


getPublicKey

public PublicKey getPublicKey()

Gets the public key for this identity.

Returns:


getScope

public final IdentityScope getScope()

Gets the scope for this Identity.

Returns:


hashCode

public int hashCode()

Gets the hashcode for this Identity.


identityEquals

protected boolean identityEquals(java.security.Identity identity)

Checks for equality between this Identity and the specified object. A subclass should override this method. The default behavior is to return true if the public key and names match.

Parameters:

Returns:


removeCertificate

public void removeCertificate(java.security.Certificate certificate)

Removes a certificate from the list of ceritificates for this identity. This class checks the security manager with the call checkSecurityAccess with "removeIdentityCertificate".

Parameters:

Throws:


setInfo

public void setInfo(java.lang.String info)

Sets the general information string. This class checks the security manager with the call checkSecurityAccess with "setIdentityInfo".

Parameters:

Throws:


setPublicKey

public void setPublicKey(java.security.PublicKey key)

Sets the public key for this identity. The old key and all certificates are removed. This class checks the security manager with the call checkSecurityAccess with "setIdentityPublicKey".

Parameters:

Throws:


toString

public String toString()

Returns a string representing this Identity. This class checks the security manager with the call checkSecurityAccess with "printIdentity".

Throws:


toString

public String toString(boolean detailed)

Returns a detailed string representing this Identity. This class checks the security manager with the call checkSecurityAccess with "printIdentity".

Parameters:

Throws: