java.security

Class IdentityScope

public abstract class IdentityScope extends Identity

Deprecated: Use java.security.KeyStore, the java.security.cert package, and java.security.Principal.

IdentityScope represents a scope of an identity. IdentityScope is also an {@link Identity} and can have a name and scope along with the other qualitites identities possess.

An IdentityScope contains other {@link Identity} objects. All {@link Identity} objects are manipulated in the scope the same way. The scope is supposed to apply different scope to different type of Identities.

No identity within the same scope can have the same public key.

See Also: Identity Signer Principal Key

Constructor Summary
protected IdentityScope()
Constructor for serialization purposes.
IdentityScope(String name)
Constructs a new instance of IdentityScope with the specified name and no scope.
IdentityScope(String name, IdentityScope scope)
Constructs a new instance of IdentityScope with the specified name and {@link IdentityScope}.
Method Summary
abstract voidaddIdentity(Identity identity)
Adds an identity to his scope.
abstract IdentitygetIdentity(String name)
Returns the specified {@link Identity}, by name, within this scope.
IdentitygetIdentity(Principal principal)
Returns the specified {@link Identity}, by {@link Principal}, within this scope.
abstract IdentitygetIdentity(PublicKey key)
Returns the specified {@link Identity}, by public key, within this scope.
static IdentityScopegetSystemScope()
Returns the system's Scope.
abstract Enumeration<Identity>identities()
Returns an {@link Enumeration} of identities in this scope.
abstract voidremoveIdentity(Identity identity)
Removes an identity in this scope.
protected static voidsetSystemScope(IdentityScope scope)
Sets the scope of the system.
abstract intsize()
Returns the number of entries within this IdentityScope.
StringtoString()
Returns a string representing this instance.

Constructor Detail

IdentityScope

protected IdentityScope()
Constructor for serialization purposes.

IdentityScope

public IdentityScope(String name)
Constructs a new instance of IdentityScope with the specified name and no scope.

Parameters: name the name to use.

IdentityScope

public IdentityScope(String name, IdentityScope scope)
Constructs a new instance of IdentityScope with the specified name and {@link IdentityScope}.

Parameters: name the name to use. scope the scope to use.

Throws: KeyManagementException if the identity scope is already present.

Method Detail

addIdentity

public abstract void addIdentity(Identity identity)
Adds an identity to his scope.

Parameters: identity the {@link Identity} to add.

Throws: KeyManagementException if it is an invalid identity, an identity with the same key exists, or if another error occurs.

getIdentity

public abstract Identity getIdentity(String name)
Returns the specified {@link Identity}, by name, within this scope.

Parameters: name name of {@link Identity} to get.

Returns: an {@link Identity} representing the name or null if it cannot be found.

getIdentity

public Identity getIdentity(Principal principal)
Returns the specified {@link Identity}, by {@link Principal}, within this scope.

Parameters: principal the {@link Principal} to use.

Returns: an identity representing the {@link Principal} or null if it cannot be found.

getIdentity

public abstract Identity getIdentity(PublicKey key)
Returns the specified {@link Identity}, by public key, within this scope.

Parameters: key the {@link PublicKey} to use.

Returns: an identity representing the public key or null if it cannot be found.

getSystemScope

public static IdentityScope getSystemScope()
Returns the system's Scope.

Returns: the system's Scope.

identities

public abstract Enumeration<Identity> identities()
Returns an {@link Enumeration} of identities in this scope.

Returns: an {@link Enumeration} of the identities in this scope.

removeIdentity

public abstract void removeIdentity(Identity identity)
Removes an identity in this scope.

Parameters: identity the {@link Identity} to remove.

Throws: KeyManagementException if it is a missing identity, or if another error occurs.

setSystemScope

protected static void setSystemScope(IdentityScope scope)
Sets the scope of the system.

Parameters: scope the new system scope.

Throws: SecurityException if a {@link SecurityManager} is installed which disallows this operation.

size

public abstract int size()
Returns the number of entries within this IdentityScope.

Returns: the number of entries within this IdentityScope.

toString

public String toString()
Returns a string representing this instance. It includes the name, the scope name, and number of identities.

Returns: a string representation of this instance.