Class Identity
- All Implemented Interfaces:
- Serializable,- Principal
- Direct Known Subclasses:
- IdentityScope,- Signer
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.
- Since:
- 1.1
- See Also:
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedIdentity()Deprecated, for removal: This API element is subject to removal in a future version.Constructor for serialization only.Deprecated, for removal: This API element is subject to removal in a future version.Constructs anIdentitywith the specified name and no scope.Identity(String name, IdentityScope scope) Deprecated, for removal: This API element is subject to removal in a future version.Constructs anIdentitywith the specified name and scope.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCertificate(Certificate certificate) Deprecated, for removal: This API element is subject to removal in a future version.Adds a certificate for thisIdentity.Deprecated, for removal: This API element is subject to removal in a future version.Returns a copy of all the certificates for thisIdentity.final booleanDeprecated, for removal: This API element is subject to removal in a future version.Tests for equality between the specified object and thisIdentity.getInfo()Deprecated, for removal: This API element is subject to removal in a future version.Returns general information previously specified for thisIdentity.final StringgetName()Deprecated, for removal: This API element is subject to removal in a future version.Returns this identity's name.Deprecated, for removal: This API element is subject to removal in a future version.Returns this identity's public key.final IdentityScopegetScope()Deprecated, for removal: This API element is subject to removal in a future version.Returns this identity's scope.inthashCode()Deprecated, for removal: This API element is subject to removal in a future version.Returns the hashcode for thisIdentity.protected booleanidentityEquals(Identity identity) Deprecated, for removal: This API element is subject to removal in a future version.Tests for equality between the specifiedIdentityand thisIdentity.voidremoveCertificate(Certificate certificate) Deprecated, for removal: This API element is subject to removal in a future version.Removes a certificate from thisIdentity.voidDeprecated, for removal: This API element is subject to removal in a future version.Specifies a general information string for thisIdentity.voidsetPublicKey(PublicKey key) Deprecated, for removal: This API element is subject to removal in a future version.Sets this identity's public key.toString()Deprecated, for removal: This API element is subject to removal in a future version.Returns a short string describing thisIdentity, telling its name and its scope (if any).toString(boolean detailed) Deprecated, for removal: This API element is subject to removal in a future version.Returns a string representation of thisIdentity, with optionally more details than that provided by thetoStringmethod without any arguments.
- 
Constructor Details- 
Identityprotected Identity()Deprecated, for removal: This API element is subject to removal in a future version.Constructor for serialization only.
- 
IdentityDeprecated, for removal: This API element is subject to removal in a future version.Constructs anIdentitywith the specified name and scope.- Parameters:
- name- the- Identityname.
- scope- the scope of the- Identity.
- Throws:
- KeyManagementException- if there is already an- Identitywith the same name in the scope.
 
- 
IdentityDeprecated, for removal: This API element is subject to removal in a future version.Constructs anIdentitywith the specified name and no scope.- Parameters:
- name- the identity name.
 
 
- 
- 
Method Details- 
getName
- 
getScopeDeprecated, for removal: This API element is subject to removal in a future version.Returns this identity's scope.- Returns:
- the scope of this Identity.
 
- 
getPublicKeyDeprecated, for removal: This API element is subject to removal in a future version.Returns this identity's public key.- Returns:
- the public key for this Identity.
- See Also:
 
- 
setPublicKeyDeprecated, for removal: This API element is subject to removal in a future version.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.
- See Also:
 
- 
setInfoDeprecated, for removal: This API element is subject to removal in a future version.Specifies a general information string for thisIdentity.- Parameters:
- info- the information string.
- See Also:
 
- 
getInfoDeprecated, for removal: This API element is subject to removal in a future version.Returns general information previously specified for thisIdentity.- Returns:
- general information about this Identity.
- See Also:
 
- 
addCertificateDeprecated, for removal: This API element is subject to removal in a future version.Adds a certificate for thisIdentity. If theIdentityhas a public key, the public key in the certificate must be the same, and if theIdentitydoes 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.
 
- 
removeCertificateDeprecated, for removal: This API element is subject to removal in a future version.Removes a certificate from thisIdentity.- Parameters:
- certificate- the certificate to be removed.
- Throws:
- KeyManagementException- if the certificate is missing, or if another exception occurs.
 
- 
certificatesDeprecated, for removal: This API element is subject to removal in a future version.Returns a copy of all the certificates for thisIdentity.- Returns:
- a copy of all the certificates for this Identity.
 
- 
equalsDeprecated, for removal: This API element is subject to removal in a future version.Tests for equality between the specified object and thisIdentity. This first tests to see if the entities actually refer to the same object, in which case it returnstrue. Next, it checks to see if the entities have the same name and the same scope. If they do, the method returnstrue. Otherwise, it callsidentityEquals, which subclasses should override.
- 
identityEqualsDeprecated, for removal: This API element is subject to removal in a future version.Tests for equality between the specifiedIdentityand thisIdentity. This method should be overridden by subclasses to test for equality. The default behavior is to returntrueif the names and public keys are equal.- Parameters:
- identity- the identity to test for equality with this- identity.
- Returns:
- trueif the identities are considered equal,- falseotherwise.
- See Also:
 
- 
toStringDeprecated, for removal: This API element is subject to removal in a future version.Returns a short string describing thisIdentity, telling its name and its scope (if any).
- 
toStringDeprecated, for removal: This API element is subject to removal in a future version.Returns a string representation of thisIdentity, with optionally more details than that provided by thetoStringmethod without any arguments.- Parameters:
- detailed- whether or not to provide detailed information.
- Returns:
- information about this Identity. Ifdetailedistrue, then this method returns more information than that provided by thetoStringmethod without any arguments.
- See Also:
 
- 
hashCode
 
- 
java.security.KeyStore, thejava.security.certpackage, andjava.security.Principal.