public abstract class

Identity

extends Object
implements Serializable Principal
java.lang.Object
   ↳ java.security.Identity
Known Direct Subclasses

This class is deprecated.The functionality of this class has been replace by Principal, KeyStore and the java.security.cert package.

Class Overview

Identity represents an identity like a person or a company.

Summary

Public Constructors
Identity(String name)
Creates a new instance of Identity with the specified name.
Identity(String name, IdentityScope scope)
Creates a new instance of Identity with the specified name and the scope of this Identity.
Protected Constructors
Identity()
Constructs a new instance of Identity.
Public Methods
void addCertificate(Certificate certificate)
Adds a Certificate to this Identity.
Certificate[] certificates()
Returns the certificates for this Identity.
final boolean equals(Object obj)
Compares the specified object with this Identity for equality and returns true if the specified object is equal, false otherwise.
String getInfo()
Returns the information string of this Identity.
final String getName()
Returns the name of this Identity.
PublicKey getPublicKey()
Returns the PublicKey associated with this Identity.
final IdentityScope getScope()
Returns the IdentityScope of this Identity.
int hashCode()
Returns the hash code value for this Identity.
void removeCertificate(Certificate certificate)
Removes the specified Certificate from this Identity.
void setInfo(String info)
Sets an information string for this Identity.
void setPublicKey(PublicKey key)
Sets the specified PublicKey to this Identity.
String toString(boolean detailed)
Returns a string containing a concise, human-readable description of the this Identity.
String toString()
Returns a string containing a concise, human-readable description of the this Identity including its name and its scope.
Protected Methods
boolean identityEquals(Identity identity)
Compares the specified Identity with this Identity for equality and returns true if the specified object is equal, false otherwise.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.security.Principal

Public Constructors

public Identity (String name)

Creates a new instance of Identity with the specified name.

Parameters
name the name of this Identity.

public Identity (String name, IdentityScope scope)

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

Parameters
name the name of this Identity.
scope the IdentityScope of this Identity.
Throws
KeyManagementException if an Identity with the same name is already present in the specified scope.

Protected Constructors

protected Identity ()

Constructs a new instance of Identity.

Public Methods

public void addCertificate (Certificate certificate)

Adds a Certificate to this Identity.

If a SecurityManager is installed, code calling this method needs the SecurityPermission addIdentityCertificate to be granted, otherwise a SecurityException will be thrown.

Parameters
certificate the Certificate to be added to this Identity.
Throws
KeyManagementException if the certificate is not valid.
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method.

public Certificate[] certificates ()

Returns the certificates for this Identity. External modifications of the returned array has no impact on this Identity.

Returns
  • the Certificates for this Identity

public final boolean equals (Object obj)

Compares the specified object with this Identity for equality and returns true if the specified object is equal, false otherwise. Identity objects are considered equal, if they have the same name and are in the same scope.

Parameters
obj object to be compared for equality with this Identity.
Returns
  • true if the specified object is equal to this Identity, otherwise false.

public String getInfo ()

Returns the information string of this Identity.

Returns
  • the information string of this Identity.

public final String getName ()

Returns the name of this Identity.

Returns
  • the name of this Identity.

public PublicKey getPublicKey ()

Returns the PublicKey associated with this Identity.

Returns
  • the PublicKey associated with this Identity.

public final IdentityScope getScope ()

Returns the IdentityScope of this Identity.

Returns
  • the IdentityScope of this Identity.

public int hashCode ()

Returns the hash code value for this Identity. Returns the same hash code for Identitys that are equal to each other as required by the general contract of hashCode().

Returns
  • the hash code value for this Identity.

public void removeCertificate (Certificate certificate)

Removes the specified Certificate from this Identity.

If a SecurityManager is installed, code calling this method needs the SecurityPermission "removeIdentityCertificate" to be granted, otherwise a SecurityException will be thrown.

Parameters
certificate the Certificate to be removed.
Throws
KeyManagementException if the certificate is not found.
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method.

public void setInfo (String info)

Sets an information string for this Identity.

If a SecurityManager is installed, code calling this method needs the SecurityPermission setIdentityInfo to be granted, otherwise a SecurityException will be thrown.

Parameters
info the information to be set.
Throws
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method.

public void setPublicKey (PublicKey key)

Sets the specified PublicKey to this Identity.

If a SecurityManager is installed, code calling this method needs the SecurityPermission setIdentityPublicKey to be granted, otherwise a SecurityException will be thrown.

Parameters
key the PublicKey to be set.
Throws
KeyManagementException if another Identity in the same scope as this Identity already has the same PublicKey.
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method.

public String toString (boolean detailed)

Returns a string containing a concise, human-readable description of the this Identity.

Parameters
detailed whether or not this method should return detailed information.
Returns
  • a printable representation for this Permission.

public String toString ()

Returns a string containing a concise, human-readable description of the this Identity including its name and its scope.

If a SecurityManager is installed, code calling this method needs the SecurityPermission printIdentity to be granted, otherwise a SecurityException will be thrown.

Returns
  • a printable representation for this Identity.
Throws
SecurityException if a SecurityManager is installed and the caller does not have permission to invoke this method.

Protected Methods

protected boolean identityEquals (Identity identity)

Compares the specified Identity with this Identity for equality and returns true if the specified object is equal, false otherwise.

To be equal, two Identity objects need to have the same name and the same public keys.

Parameters
identity the identity to check for equality.
Returns
  • true if the Identity objects are equal, false otherwise.