java.security
Class Identity
java.lang.Object
|
+--java.security.Identity
All Implemented Interfaces:
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: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:
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:
- true if they are equal, false otherwise
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:
- true if they are equal, false otherwise
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: