APIdia Launch Partner
Top Description Fields Constructors Methods
java.security

public abstract Class Identity

extends Object
implements Principal, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.security.Principal
Known Direct Subclasses
java.security.IdentityScope, java.security.Signer
Annotations
@Deprecated
since:1.2
forRemoval:true
@SuppressWarnings:removal
Imports
java.io.Serializable, java.util.*

Deprecated

for removal since 1.2.

This class is deprecated and subject to removal in a future version of Java SE. It has been replaced by java.security.KeyStore, the java.security.cert package, and java.security.Principal.

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.

Author
Benjamin Renaud
Since
1.1
See Also
IdentityScope, Signer, Principal

Field Summary

Modifier and TypeField and Description
pack-priv Vector<Certificate>
certificates

The certificates for this Identity.

pack-priv String
info

Generic, descriptive information about the Identity.

private String
name

The name for this Identity.

private PublicKey
publicKey

The public key for this Identity.

pack-priv IdentityScope
scope

References Deprecated IdentityScope is deprecated or references (maybe indirectly) at least one deprecated element.
The scope of the Identity.
private static final long
serialVersionUID

use serialVersionUID from JDK 1.1.x for interoperability

Constructor Summary

AccessConstructor and Description
protected
Identity()

Constructor for serialization only.

public
Identity(String
the Identity name.
name
,
IdentityScope
the scope of the Identity.
scope
)
References Deprecated IdentityScope is deprecated or references (maybe indirectly) at least one deprecated element.

Constructs an Identity with the specified name and scope.

public
Identity(String
the identity name.
name
)

Constructs an Identity with the specified name and no scope.

Method Summary

Modifier and TypeMethod and Description
public void
addCertificate(Certificate
the certificate to be added.
certificate
)
References Deprecated Certificate is deprecated or references (maybe indirectly) at least one deprecated element.

Adds a certificate for this Identity.

public Certificate[]

Returns:

a copy of all the certificates for this Identity.
certificates
()
References Deprecated Certificate is deprecated or references (maybe indirectly) at least one deprecated element.

Returns a copy of all the certificates for this Identity.

public final boolean

Returns:

true if the objects are considered equal, false otherwise.
equals
(Object
the object to test for equality with this Identity.
identity
)

Overrides java.lang.Object.equals.

Implements java.security.Principal.equals.

Tests for equality between the specified object and this Identity.

pack-priv String
fullName()

Returns a parsable name for Identity: identityName.scopeName

public String

Returns:

general information about this Identity.
getInfo
()

Returns general information previously specified for this Identity.

public final String

Returns:

the name of this Identity.
getName
()

Implements java.security.Principal.getName.

Returns this identity's name.

public PublicKey

Returns:

the public key for this Identity.
getPublicKey
()

Returns this identity's public key.

public final IdentityScope

Returns:

the scope of this Identity.
getScope
()
References Deprecated IdentityScope is deprecated or references (maybe indirectly) at least one deprecated element.

Returns this identity's scope.

public int

Returns:

the hashcode for this Identity
hashCode
()

Overrides java.lang.Object.hashCode.

Implements java.security.Principal.hashCode.

Returns the hashcode for this Identity.

protected boolean

Returns:

true if the identities are considered equal, false otherwise.
identityEquals
(Identity
the identity to test for equality with this identity.
identity
)
References Deprecated Identity is deprecated or references (maybe indirectly) at least one deprecated element.

Tests for equality between the specified Identity and this Identity.

private boolean
keyEquals(PublicKey aKey, PublicKey anotherKey)

pack-priv String
pack-priv String
public void
removeCertificate(Certificate
the certificate to be removed.
certificate
)
References Deprecated Certificate is deprecated or references (maybe indirectly) at least one deprecated element.

Removes a certificate from this Identity.

public void
setInfo(String
the information string.
info
)

Specifies a general information string for this Identity.

public void
setPublicKey(PublicKey
the public key for this Identity.
key
)

Sets this identity's public key.

public String

Returns:

information about this Identity, such as its name and the name of its scope (if any).
toString
()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Returns a short string describing this Identity, telling its name and its scope (if any).

public String

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.
toString
(boolean
whether or not to provide detailed information.
detailed
)

Returns a string representation of this Identity, with optionally more details than that provided by the toString method without any arguments.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

certificatesback to summary
pack-priv Vector<Certificate> certificates

The certificates for this Identity.

infoback to summary
pack-priv String info

Generic, descriptive information about the Identity.

nameback to summary
private String name

The name for this Identity.

publicKeyback to summary
private PublicKey publicKey

The public key for this Identity.

scopeback to summary
pack-priv IdentityScope scope

References Deprecated

IdentityScope is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

The scope of the Identity.

serialVersionUIDback to summary
private static final long serialVersionUID

use serialVersionUID from JDK 1.1.x for interoperability

Annotations
@Serial

Constructor Detail

Identityback to summary
protected Identity()

Constructor for serialization only.

Identityback to summary
public Identity(String name, IdentityScope scope) throws KeyManagementException

References Deprecated

IdentityScope is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Constructs an Identity with the specified name and scope.

Parameters
name:String

the Identity name.

scope:IdentityScope

the scope of the Identity.

Annotations
@SuppressWarnings:this-escape
Exceptions
KeyManagementException:
if there is already an Identity with the same name in the scope.
Identityback to summary
public Identity(String name)

Constructs an Identity with the specified name and no scope.

Parameters
name:String

the identity name.

Method Detail

addCertificateback to summary
public void addCertificate(Certificate certificate) throws KeyManagementException

References Deprecated

Certificate is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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:Certificate

the certificate to be added.

Exceptions
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.
certificatesback to summary
public Certificate[] certificates()

References Deprecated

Certificate is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns a copy of all the certificates for this Identity.

Returns:Certificate[]

a copy of all the certificates for this Identity.

equalsback to summary
public final boolean equals(Object identity)

Overrides java.lang.Object.equals.

Implements java.security.Principal.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.

Parameters
identity:Object

the object to test for equality with this Identity.

Returns:boolean

true if the objects are considered equal, false otherwise.

Annotations
@Override
See Also
identityEquals
fullNameback to summary
pack-priv String fullName()

Returns a parsable name for Identity: identityName.scopeName

getInfoback to summary
public String getInfo()

Returns general information previously specified for this Identity.

Returns:String

general information about this Identity.

See Also
setInfo
getNameback to summary
public final String getName()

Implements java.security.Principal.getName.

Returns this identity's name.

Returns:String

the name of this Identity.

getPublicKeyback to summary
public PublicKey getPublicKey()

Returns this identity's public key.

Returns:PublicKey

the public key for this Identity.

See Also
setPublicKey
getScopeback to summary
public final IdentityScope getScope()

References Deprecated

IdentityScope is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns this identity's scope.

Returns:IdentityScope

the scope of this Identity.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.security.Principal.hashCode.

Returns the hashcode for this Identity.

Returns:int

the hashcode for this Identity

Annotations
@Override
identityEqualsback to summary
protected boolean identityEquals(Identity identity)

References Deprecated

Identity is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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

Parameters
identity:Identity

the identity to test for equality with this identity.

Returns:boolean

true if the identities are considered equal, false otherwise.

See Also
equals
keyEqualsback to summary
private boolean keyEquals(PublicKey aKey, PublicKey anotherKey)
printCertificatesback to summary
pack-priv String printCertificates()
printKeysback to summary
pack-priv String printKeys()
removeCertificateback to summary
public void removeCertificate(Certificate certificate) throws KeyManagementException

References Deprecated

Certificate is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Removes a certificate from this Identity.

Parameters
certificate:Certificate

the certificate to be removed.

Exceptions
KeyManagementException:
if the certificate is missing, or if another exception occurs.
setInfoback to summary
public void setInfo(String info)

Specifies a general information string for this Identity.

Parameters
info:String

the information string.

See Also
getInfo
setPublicKeyback to summary
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:PublicKey

the public key for this Identity.

Exceptions
KeyManagementException:
if another identity in the identity's scope has the same public key, or if another exception occurs.
See Also
getPublicKey
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Returns a short string describing this Identity, telling its name and its scope (if any).

Returns:String

information about this Identity, such as its name and the name of its scope (if any).

toStringback to summary
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.

Parameters
detailed:boolean

whether or not to provide detailed information.

Returns:String

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