FileDocCategorySizeDatePackage
IdentityScope.javaAPI DocAndroid 1.5 API7472Wed May 06 22:41:06 BST 2009java.security

IdentityScope

public abstract class IdentityScope extends Identity
{@code IdentityScope} represents a scope for {@link Identity} objects.
deprecated
The functionality of this class has been replace by {@link Principal}, {@link KeyStore} and the {@code java.security.cert} package.
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
private static IdentityScope
systemScope
Constructors Summary
protected IdentityScope()
Constructs a new instance of {@code IdentityScope}.

since
Android 1.0


                    
      
        super();
    
public IdentityScope(String name)
Constructs a new instance of {@code IdentityScope} with the specified name.

param
name the name of this {@code IdentityScope}.
since
Android 1.0

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

param
name the name of this {@code IdentityScope}.
param
scope the scope of this {@code IdentityScope}.
throws
KeyManagementException if an identity with the same key already exists.
since
Android 1.0

        super(name, scope);
    
Methods Summary
public abstract voidaddIdentity(java.security.Identity identity)
Adds an {@code Identity} to this {@code IdentityScope}.

param
identity the {@code Identity} to be added.
throws
KeyManagementException if the specified {@code Identity} is invalid or an identity with the same key already exists.
since
Android 1.0

public abstract java.security.IdentitygetIdentity(java.lang.String name)
Returns the {@code Identity} with the specified name or {@code null} if no {@code Identity} with the specified name is present in this scope.

param
name the name of the {@code Identity} to be returned.
return
the {@code Identity} with the specified name or {@code null} if not present.
since
Android 1.0

public java.security.IdentitygetIdentity(java.security.Principal principal)
Returns the {@code Identity} with the name of the specified principal or {@code null} if no {@code Identity} with the name of the specified principal is present in this scope.

param
principal the {@code Principal} whose name is used to lookup the {@code Identity} to be returned.
return
the {@code Identity} with the specified name or {@code null} if not present.
since
Android 1.0

        return getIdentity(principal.getName());
    
public abstract java.security.IdentitygetIdentity(java.security.PublicKey key)
Returns the {@code Identity} which is associated with the specified key or {@code null} if no {@code Identity} associated with the specified key is present in this scope.

param
key the {@code PublicKey} of the {@code Identity} to be returned.
return
the {@code Identity} associated with the specified key or {@code null} if not present.
since
Android 1.0

public static java.security.IdentityScopegetSystemScope()
Returns the system's scope.

return
the system's scope.
since
Android 1.0

        /* 
         * Test shows that the implementation class name is read from security property
         * "system.scope", and the class is only loaded from boot classpath. No default
         * implementation as fallback, i.e., return null if fails to init an instance. 
         */
        if (systemScope == null) {
            String className = AccessController.doPrivileged(new PrivilegedAction<String>(){
                public String run() {
                    return Security.getProperty("system.scope"); //$NON-NLS-1$
                }
            });
            if(className != null){
                try {
                    systemScope = (IdentityScope) Class.forName(className).newInstance();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return systemScope;
    
public abstract java.util.Enumerationidentities()
Returns an {@code Enumeration} over the {@code Identity} objects in this {@code IdentityScope}.

return
an {@code Enumeration} over the {@code Identity} objects in this {@code IdentityScope}.
since
Android 1.0

public abstract voidremoveIdentity(java.security.Identity identity)
Removes an {@code Identity} from this {@code IdentityScope}.

param
identity the {@code Identity} to be removed.
throws
KeyManagementException if the {@code Identity} is not present in this scope.
since
Android 1.0

protected static voidsetSystemScope(java.security.IdentityScope scope)
Sets the system's scope.

param
scope the scope to set.
since
Android 1.0

        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkSecurityAccess("setSystemScope"); //$NON-NLS-1$
        }
        systemScope = scope;
    
public abstract intsize()
Returns the number of {@code Identity} objects in this scope.

return
the number of {@code Identity} objects in this scope.
since
Android 1.0

public java.lang.StringtoString()
Returns a string containing a concise, human-readable description of this {@code IdentityScope}.

return
a printable representation for this {@code IdentityScope}.
since
Android 1.0

        return new StringBuffer(super.toString())
                .append("[").append(size()).append("]").toString(); //$NON-NLS-1$ //$NON-NLS-2$