|
From: <ls...@us...> - 2009-02-16 20:42:01
|
Revision: 5036
http://jnode.svn.sourceforge.net/jnode/?rev=5036&view=rev
Author: lsantha
Date: 2009-02-16 20:41:55 +0000 (Mon, 16 Feb 2009)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/security/AlgorithmParameterGenerator.java
trunk/core/src/openjdk/java/java/security/AllPermission.java
trunk/core/src/openjdk/java/java/security/BasicPermission.java
trunk/core/src/openjdk/java/java/security/DigestInputStream.java
trunk/core/src/openjdk/java/java/security/DigestOutputStream.java
trunk/core/src/openjdk/java/java/security/GuardedObject.java
trunk/core/src/openjdk/java/java/security/Identity.java
trunk/core/src/openjdk/java/java/security/IdentityScope.java
trunk/core/src/openjdk/java/java/security/KeyFactory.java
trunk/core/src/openjdk/java/java/security/MessageDigest.java
trunk/core/src/openjdk/java/java/security/MessageDigestSpi.java
trunk/core/src/openjdk/java/java/security/Permission.java
trunk/core/src/openjdk/java/java/security/PermissionCollection.java
trunk/core/src/openjdk/java/java/security/Permissions.java
trunk/core/src/openjdk/java/java/security/SecureRandom.java
trunk/core/src/openjdk/java/java/security/Security.java
trunk/core/src/openjdk/java/java/security/SecurityPermission.java
trunk/core/src/openjdk/java/java/security/Signature.java
trunk/core/src/openjdk/java/java/security/SignedObject.java
trunk/core/src/openjdk/java/java/security/Signer.java
trunk/core/src/openjdk/java/java/security/UnresolvedPermission.java
trunk/core/src/openjdk/java/java/security/UnresolvedPermissionCollection.java
trunk/core/src/openjdk/java/java/util/jar/Attributes.java
trunk/core/src/openjdk/java/java/util/jar/JarEntry.java
trunk/core/src/openjdk/java/java/util/jar/JarException.java
trunk/core/src/openjdk/java/java/util/jar/JarFile.java
trunk/core/src/openjdk/java/java/util/jar/JarInputStream.java
trunk/core/src/openjdk/java/java/util/jar/JarOutputStream.java
trunk/core/src/openjdk/java/java/util/jar/JarVerifier.java
trunk/core/src/openjdk/java/java/util/jar/Manifest.java
trunk/core/src/openjdk/java/java/util/jar/package.html
trunk/core/src/openjdk/sun/sun/security/provider/ConfigSpiFile.java
trunk/core/src/openjdk/sun/sun/security/provider/PolicySpiFile.java
trunk/core/src/openjdk/sun/sun/security/provider/SecureRandom.java
trunk/core/src/openjdk/sun/sun/security/provider/SeedGenerator.java
trunk/core/src/openjdk/sun/sun/security/provider/Sun.java
trunk/core/src/openjdk/sun/sun/security/provider/SunEntries.java
trunk/core/src/openjdk/sun/sun/security/provider/VerificationProvider.java
trunk/core/src/openjdk/sun/sun/security/util/ManifestEntryVerifier.java
trunk/core/src/openjdk/svm/sun/security/
trunk/core/src/openjdk/svm/sun/security/provider/
trunk/core/src/openjdk/svm/sun/security/provider/NativePRNG.java
trunk/core/src/openjdk/vm/java/util/jar/
trunk/core/src/openjdk/vm/java/util/jar/NativeJarFile.java
trunk/core/src/openjdk/vm/sun/security/
trunk/core/src/openjdk/vm/sun/security/provider/
trunk/core/src/openjdk/vm/sun/security/provider/NativeSeedGenerator.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/security/AlgorithmParameterGenerator.java
trunk/core/src/classpath/java/java/security/AllPermission.java
trunk/core/src/classpath/java/java/security/BasicPermission.java
trunk/core/src/classpath/java/java/security/DigestInputStream.java
trunk/core/src/classpath/java/java/security/DigestOutputStream.java
trunk/core/src/classpath/java/java/security/DummyMessageDigest.java
trunk/core/src/classpath/java/java/security/DummySignature.java
trunk/core/src/classpath/java/java/security/GuardedObject.java
trunk/core/src/classpath/java/java/security/Identity.java
trunk/core/src/classpath/java/java/security/IdentityScope.java
trunk/core/src/classpath/java/java/security/IntersectingDomainCombiner.java
trunk/core/src/classpath/java/java/security/KeyFactory.java
trunk/core/src/classpath/java/java/security/MessageDigest.java
trunk/core/src/classpath/java/java/security/MessageDigestSpi.java
trunk/core/src/classpath/java/java/security/Permission.java
trunk/core/src/classpath/java/java/security/PermissionCollection.java
trunk/core/src/classpath/java/java/security/Permissions.java
trunk/core/src/classpath/java/java/security/SecureRandom.java
trunk/core/src/classpath/java/java/security/Security.java
trunk/core/src/classpath/java/java/security/SecurityPermission.java
trunk/core/src/classpath/java/java/security/Signature.java
trunk/core/src/classpath/java/java/security/SignedObject.java
trunk/core/src/classpath/java/java/security/Signer.java
trunk/core/src/classpath/java/java/security/UnresolvedPermission.java
trunk/core/src/classpath/java/java/util/jar/
Deleted: trunk/core/src/classpath/java/java/security/AlgorithmParameterGenerator.java
===================================================================
--- trunk/core/src/classpath/java/java/security/AlgorithmParameterGenerator.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/AlgorithmParameterGenerator.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,259 +0,0 @@
-/* AlgorithmParameterGenerator.java --- Algorithm Parameter Generator
- Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import gnu.java.security.Engine;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * <code>AlgorithmParameterGenerator</code> is used to generate algorithm
- * parameters for specified algorithms.
- *
- * <p>In case the client does not explicitly initialize the
- * <code>AlgorithmParameterGenerator</code> (via a call to an
- * <code>init()</code> method), each provider must supply (and document) a
- * default initialization. For example, the <b>GNU</b> provider uses a default
- * modulus prime size of <code>1024</code> bits for the generation of <i>DSA</i>
- * parameters.
- *
- * @author Mark Benvenuto
- * @since 1.2
- * @see AlgorithmParameters
- * @see AlgorithmParameterSpec
- */
-public class AlgorithmParameterGenerator
-{
- /** Service name for algorithm parameter generators. */
- private static final String ALGORITHM_PARAMETER_GENERATOR =
- "AlgorithmParameterGenerator";
-
- private AlgorithmParameterGeneratorSpi paramGenSpi;
- private Provider provider;
- private String algorithm;
-
- /**
- * Constructs a new instance of <code>AlgorithmParameterGenerator</code>.
- *
- * @param paramGenSpi
- * the generator to use.
- * @param provider
- * the provider to use.
- * @param algorithm
- * the algorithm to use.
- */
- protected AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi
- paramGenSpi, Provider provider,
- String algorithm)
- {
- this.paramGenSpi = paramGenSpi;
- this.provider = provider;
- this.algorithm = algorithm;
- }
-
- /** @return the name of the algorithm. */
- public final String getAlgorithm()
- {
- return algorithm;
- }
-
- /**
- * Returns a new <code>AlgorithmParameterGenerator</code> instance which
- * generates algorithm parameters for the specified algorithm.
- *
- * @param algorithm
- * the name of algorithm to use.
- * @return the new instance.
- * @throws NoSuchAlgorithmException
- * if <code>algorithm</code> is not implemented by any provider.
- */
- public static AlgorithmParameterGenerator getInstance(String algorithm)
- throws NoSuchAlgorithmException
- {
- Provider[] p = Security.getProviders();
- for (int i = 0; i < p.length; i++)
- try
- {
- return getInstance(algorithm, p[i]);
- }
- catch (NoSuchAlgorithmException e)
- {
- // Ignore.
- }
-
- throw new NoSuchAlgorithmException(algorithm);
- }
-
- /**
- * Returns a new <code>AlgorithmParameterGenerator</code> instance which
- * generates algorithm parameters for the specified algorithm.
- *
- * @param algorithm
- * the name of algorithm to use.
- * @param provider
- * the name of the {@link Provider} to use.
- * @return the new instance.
- * @throws NoSuchAlgorithmException
- * if the algorithm is not implemented by the named provider.
- * @throws NoSuchProviderException
- * if the named provider was not found.
- */
- public static AlgorithmParameterGenerator getInstance(String algorithm,
- String provider)
- throws NoSuchAlgorithmException, NoSuchProviderException
- {
- if (provider == null || provider.length() == 0)
- throw new IllegalArgumentException("Illegal provider");
-
- Provider p = Security.getProvider(provider);
- if (p == null)
- throw new NoSuchProviderException(provider);
-
- return getInstance(algorithm, p);
- }
-
- /**
- * Returns a new <code>AlgorithmParameterGenerator</code> instance which
- * generates algorithm parameters for the specified algorithm.
- *
- * @param algorithm
- * the name of algorithm to use.
- * @param provider
- * the {@link Provider} to use.
- * @return the new instance.
- * @throws NoSuchAlgorithmException
- * if the algorithm is not implemented by {@link Provider}.
- * @since 1.4
- * @see Provider
- */
- public static AlgorithmParameterGenerator getInstance(String algorithm,
- Provider provider)
- throws NoSuchAlgorithmException
- {
- if (provider == null)
- throw new IllegalArgumentException("Illegal provider");
-
- try
- {
- return new AlgorithmParameterGenerator(
- (AlgorithmParameterGeneratorSpi) Engine.getInstance(
- ALGORITHM_PARAMETER_GENERATOR, algorithm, provider),
- provider, algorithm);
- }
- catch (java.lang.reflect.InvocationTargetException ite)
- {
- throw new NoSuchAlgorithmException(algorithm);
- }
- catch (ClassCastException cce)
- {
- throw new NoSuchAlgorithmException(algorithm);
- }
- }
-
- /** @return the {@link Provider} of this generator. */
- public final Provider getProvider()
- {
- return provider;
- }
-
- /**
- * Initializes this instance with the specified size. Since no source of
- * randomness is supplied, a default one will be used.
- *
- * @param size
- * size (in bits) to use.
- */
- public final void init(int size)
- {
- init(size, new SecureRandom());
- }
-
- /**
- * Initializes this instance with the specified key-size and source of
- * randomness.
- *
- * @param size
- * the size (in bits) to use.
- * @param random
- * the {@link SecureRandom} to use.
- */
- public final void init(int size, SecureRandom random)
- {
- paramGenSpi.engineInit(size, random);
- }
-
- /**
- * Initializes this instance with the specified {@link AlgorithmParameterSpec}.
- * Since no source of randomness is supplied, a default one will be used.
- *
- * @param genParamSpec
- * the {@link AlgorithmParameterSpec} to use.
- * @throws InvalidAlgorithmParameterException
- * if <code>genParamSpec</code> is invalid.
- */
- public final void init(AlgorithmParameterSpec genParamSpec)
- throws InvalidAlgorithmParameterException
- {
- init(genParamSpec, new SecureRandom());
- }
-
- /**
- * Initializes this instance with the specified {@link AlgorithmParameterSpec}
- * and source of randomness.
- *
- * @param genParamSpec
- * the {@link AlgorithmParameterSpec} to use.
- * @param random
- * the {@link SecureRandom} to use.
- * @throws InvalidAlgorithmParameterException
- * if <code>genParamSpec</code> is invalid.
- */
- public final void init(AlgorithmParameterSpec genParamSpec,
- SecureRandom random)
- throws InvalidAlgorithmParameterException
- {
- paramGenSpi.engineInit(genParamSpec, random);
- }
-
- /** @return a new instance of {@link AlgorithmParameters}. */
- public final AlgorithmParameters generateParameters()
- {
- return paramGenSpi.engineGenerateParameters();
- }
-}
Deleted: trunk/core/src/classpath/java/java/security/AllPermission.java
===================================================================
--- trunk/core/src/classpath/java/java/security/AllPermission.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/AllPermission.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,198 +0,0 @@
-/* AllPermission.java -- Permission to do anything
- Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import gnu.java.util.EmptyEnumeration;
-
-import java.util.Collections;
-import java.util.Enumeration;
-
-/**
- * This class is a permission that implies all other permissions. Granting
- * this permission effectively grants all others. Extreme caution should
- * be exercised in granting this permission.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Eric Blake (eb...@em...)
- * @see AccessController
- * @see Permissions
- * @see SecurityManager
- * @since 1.1
- * @status updated to 1.4
- */
-public final class AllPermission extends Permission
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -2916474571451318075L;
-
- /**
- * Create a new AllPermission object.
- */
- public AllPermission()
- {
- super("*");
- }
-
- /**
- * Create a new AllPermission object. The parameters are ignored, as all
- * permission implies ALL PERMISSION.
- *
- * @param name ignored
- * @param actions ignored
- */
- public AllPermission(String name, String actions)
- {
- super("*");
- }
-
- /**
- * This method always returns <code>true</code> to indicate that this
- * permission always implies that any other permission is also granted.
- *
- * @param perm ignored
- * @return true, the permission is implied
- */
- public boolean implies(Permission perm)
- {
- return true;
- }
-
- /**
- * Checks an object for equality. All AllPermissions are equal.
- *
- * @param obj the <code>Object</code> to test for equality
- */
- public boolean equals(Object obj)
- {
- return obj instanceof AllPermission;
- }
-
- /**
- * This method returns a hash code for this object. This returns 1.
- *
- * @return a hash value for this object
- */
- public int hashCode()
- {
- return 1;
- }
-
- /**
- * This method returns the list of actions associated with this object.
- * This will always be the empty string ("") for this class.
- *
- * @return the action list
- */
- public String getActions()
- {
- return "";
- }
-
- /**
- * Returns a PermissionCollection which can hold AllPermission.
- *
- * @return a permission collection
- */
- public PermissionCollection newPermissionCollection()
- {
- return new AllPermissionCollection();
- }
-
- /**
- * Implements AllPermission.newPermissionCollection, and obeys serialization
- * of JDK.
- *
- * @author Eric Blake (eb...@em...)
- */
- private static final class AllPermissionCollection extends PermissionCollection
- {
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -4023755556366636806L;
-
- /**
- * Whether an AllPermission has been added to the collection.
- *
- * @serial if all permission is in the collection yet
- */
- private boolean all_allowed;
-
- /**
- * Add an AllPermission.
- *
- * @param perm the permission to add
- * @throws IllegalArgumentException if perm is not an AllPermission
- * @throws SecurityException if the collection is read-only
- */
- public void add(Permission perm)
- {
- if (isReadOnly())
- throw new SecurityException();
- if (! (perm instanceof AllPermission))
- throw new IllegalArgumentException();
- all_allowed = true;
- }
-
- /**
- * Returns true if this collection implies a permission.
- *
- * @param perm the permission to check
- * @return true if this collection contains an AllPermission
- */
- public boolean implies(Permission perm)
- {
- return all_allowed;
- }
-
- /**
- * Returns an enumeration of the elements in the collection.
- *
- * @return the elements in the collection
- */
- public Enumeration elements()
- {
- return all_allowed
- ? Collections.enumeration(Collections.singleton(new AllPermission()))
- : EmptyEnumeration.getInstance();
- }
- } // class AllPermissionCollection
-} // class AllPermission
Deleted: trunk/core/src/classpath/java/java/security/BasicPermission.java
===================================================================
--- trunk/core/src/classpath/java/java/security/BasicPermission.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/BasicPermission.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,308 +0,0 @@
-/* BasicPermission.java -- implements a simple named permission
- Copyright (C) 1998, 1999, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-/**
- * This class implements a simple model for named permissions without an
- * associated action list. That is, either the named permission is granted
- * or it is not.
- *
- * <p>It also supports trailing wildcards to allow the easy granting of
- * permissions in a hierarchical fashion. (For example, the name "org.gnu.*"
- * might grant all permissions under the "org.gnu" permissions hierarchy).
- * The only valid wildcard character is a '*' which matches anything. It
- * must be the rightmost element in the permission name and must follow a
- * '.' or else the Permission name must consist of only a '*'. Any other
- * occurrence of a '*' is not valid.
- *
- * <p>This class ignores the action list. Subclasses can choose to implement
- * actions on top of this class if desired.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Eric Blake (eb...@em...)
- * @see Permission
- * @see Permissions
- * @see PermissionCollection
- * @see RuntimePermission
- * @see SecurityPermission
- * @see PropertyPermission
- * @see AWTPermission
- * @see NetPermission
- * @see SecurityManager
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class BasicPermission extends Permission
- implements Serializable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 6279438298436773498L;
-
- /**
- * Create a new instance with the specified permission name. If the
- * name is empty an exception is thrown.
- *
- * @param name the name of this permission
- * @throws NullPointerException if name is null
- * @throws IllegalArgumentException if name is invalid
- */
- public BasicPermission(String name)
- {
- super(name);
-
- // This routine used to check for illegal wildcards, but no such
- // requirement exists in the specification and Sun's runtime
- // doesn't appear to do it.
-
- if (name.equals(""))
- throw new IllegalArgumentException("Empty name");
- }
-
- /**
- * Create a new instance with the specified permission name. If the name
- * is empty, or contains an illegal wildcard character, an exception is
- * thrown. The actions parameter is ignored.
- *
- * @param name the name of this permission
- * @param actions ignored
- * @throws NullPointerException if name is null
- * @throws IllegalArgumentException if name is invalid
- */
- public BasicPermission(String name, String actions)
- {
- this(name);
- }
-
- /**
- * This method tests to see if the specified permission is implied by this
- * permission. This will be true if the following conditions are met:<ul>
- * <li>The specified object is an instance of the same class as this
- * object.</li>
- * <li>The name of the specified permission is implied by this permission's
- * name based on wildcard matching. For example, "a.*" implies "a.b".</li>
- * </ul>
- *
- * @param perm the <code>Permission</code> object to test against
- * @return true if the specified permission is implied
- */
- public boolean implies(Permission perm)
- {
- if (! getClass().isInstance(perm))
- return false;
-
- String otherName = perm.getName();
- String name = getName();
-
- if (name.equals(otherName))
- return true;
-
- int last = name.length() - 1;
- return name.charAt(last) == '*'
- && otherName.startsWith(name.substring(0, last));
- }
-
- /**
- * This method tests to see if this object is equal to the specified
- * <code>Object</code>. This will be true if and only if the specified
- * object meets the following conditions:<ul>
- * <li>It is an instance of the same class as this.</li>
- * <li>It has the same name as this permission.</li>
- * </ul>
- *
- * @param obj the <code>Object</code> to test for equality
- * @return true if obj is semantically equal to this
- */
- public boolean equals(Object obj)
- {
- return getClass().isInstance(obj)
- && getName().equals(((BasicPermission) obj).getName());
- }
-
- /**
- * This method returns a hash code for this permission object. The hash
- * code returned is the value returned by calling the <code>hashCode</code>
- * method on the <code>String</code> that is the name of this permission.
- *
- * @return a hash value for this object
- */
- public int hashCode()
- {
- return getName().hashCode();
- }
-
- /**
- * This method returns a list of the actions associated with this
- * permission. This method always returns the empty string ("") since
- * this class ignores actions.
- *
- * @return the action list
- */
- public String getActions()
- {
- return "";
- }
-
- /**
- * This method returns an instance of <code>PermissionCollection</code>
- * suitable for storing <code>BasicPermission</code> objects. The
- * collection returned can only store objects of the same type as this.
- * Subclasses which use actions must override this method; but a class with
- * no actions will work fine with this.
- *
- * @return a new empty <code>PermissionCollection</code> object
- */
- public PermissionCollection newPermissionCollection()
- {
- return new BasicPermissionCollection(getClass());
- }
-
- /**
- * Implements AllPermission.newPermissionCollection, and obeys serialization
- * of JDK.
- *
- * @author Eric Blake (eb...@em...)
- */
- private static final class BasicPermissionCollection extends PermissionCollection
- {
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 739301742472979399L;
-
- /**
- * The permissions in the collection.
- *
- * @serial a hash mapping name to permissions, all of type permClass
- */
- private final Hashtable permissions = new Hashtable();
-
- /**
- * If "*" is in the collection.
- *
- * @serial true if a permission named "*" is in the collection
- */
- private boolean all_allowed;
-
- /**
- * The runtime class which all entries in the table must belong to.
- *
- * @serial the limiting subclass of this collection
- */
- private final Class permClass;
-
- /**
- * Construct a collection over the given runtime class.
- *
- * @param c the class
- */
- BasicPermissionCollection(Class c)
- {
- permClass = c;
- }
-
- /**
- * Add a Permission. It must be of the same type as the permission which
- * created this collection.
- *
- * @param perm the permission to add
- * @throws IllegalArgumentException if perm is not the correct type
- * @throws SecurityException if the collection is read-only
- */
- public void add(Permission perm)
- {
- if (isReadOnly())
- throw new SecurityException("readonly");
- if (! permClass.isInstance(perm))
- throw new IllegalArgumentException("Expecting instance of " + permClass);
- BasicPermission bp = (BasicPermission) perm;
- String name = bp.getName();
- if (name.equals("*"))
- all_allowed = true;
- permissions.put(name, bp);
- }
-
- /**
- * Returns true if this collection implies the given permission.
- *
- * @param permission the permission to check
- * @return true if it is implied by this
- */
- public boolean implies(Permission permission)
- {
- if (! permClass.isInstance(permission))
- return false;
- if (all_allowed)
- return true;
- BasicPermission toImply = (BasicPermission) permission;
- String name = toImply.getName();
- if (name.equals("*"))
- return false;
- int prefixLength = name.length();
- if (name.endsWith("*"))
- prefixLength -= 2;
-
- while (true)
- {
- if (permissions.get(name) != null)
- return true;
- prefixLength = name.lastIndexOf('.', prefixLength);
- if (prefixLength < 0)
- return false;
- name = name.substring(0, prefixLength + 1) + '*';
- }
- }
-
- /**
- * Enumerate over the collection.
- *
- * @return an enumeration of the collection contents
- */
- public Enumeration elements()
- {
- return permissions.elements();
- }
- } // class BasicPermissionCollection
-} // class BasicPermission
Deleted: trunk/core/src/classpath/java/java/security/DigestInputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/security/DigestInputStream.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/DigestInputStream.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,167 +0,0 @@
-/* DigestInputStream.java --- An Input stream tied to a message digest
- Copyright (C) 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * DigestInputStream is a class that ties an InputStream with a
- * MessageDigest. The Message Digest is used by the class to
- * update it self as bytes are read from the InputStream.
- *
- * The updating to the digest depends on the on flag which is set
- * to true by default to tell the class to update the data
- * in the message digest.
- *
- * @version 0.0
- * @author Mark Benvenuto (ivy...@wo...)
- */
-public class DigestInputStream extends FilterInputStream
-{
- /**
- * The message digest for the DigestInputStream
- */
- protected MessageDigest digest;
-
- //Manages the on flag
- private boolean state = true;
-
- /**
- * Constructs a new DigestInputStream.
- * It associates a MessageDigest with the stream to
- * compute the stream as data is written.
- *
- * @param stream An InputStream to associate this stream with
- * @param digest A MessageDigest to hash the stream with
- */
- public DigestInputStream(InputStream stream, MessageDigest digest)
- {
- super(stream);
- //this.in = stream;
- this.digest = digest;
- }
-
- /**
- * Returns the MessageDigest associated with this DigestInputStream
- *
- * @return The MessageDigest used to hash this stream
- */
- public MessageDigest getMessageDigest()
- {
- return digest;
- }
-
- /**
- * Sets the current MessageDigest to current parameter
- *
- * @param digest A MessageDigest to associate with this stream
- */
- public void setMessageDigest(MessageDigest digest)
- {
- this.digest = digest;
- }
-
- /**
- * Reads a byte from the input stream and updates the digest.
- * This method reads the underlying input stream and if the
- * on flag is true then updates the message digest.
- *
- * @return Returns a byte from the input stream, -1 is returned to indicate that
- * the end of stream was reached before this read call
- *
- * @throws IOException if an IO error occurs in the underlying input stream,
- * this error is thrown
- */
- public int read() throws IOException
- {
- int temp = in.read();
-
- if (state == true && temp != -1)
- digest.update((byte) temp);
-
- return temp;
- }
-
- /**
- * Reads bytes from the input stream and updates the digest.
- * This method reads the underlying input stream and if the
- * on flag is true then updates the message digest.
- *
- * @param b a byte array to store the data from the input stream
- * @param off an offset to start at in the array
- * @param len length of data to read
- * @return Returns count of bytes read, -1 is returned to indicate that
- * the end of stream was reached before this read call
- *
- * @throws IOException if an IO error occurs in the underlying input stream,
- * this error is thrown
- */
- public int read(byte[]b, int off, int len) throws IOException
- {
- int temp = in.read(b, off, len);
-
- if (state == true && temp != -1)
- digest.update(b, off, temp);
-
- return temp;
- }
-
- /**
- * Sets the flag specifing if this DigestInputStream updates the
- * digest in the write() methods. The default is on;
- *
- * @param on True means it digests stream, false means it does not
- */
- public void on(boolean on)
- {
- state = on;
- }
-
- /**
- * Converts the input stream and underlying message digest to a string.
- *
- * @return A string representing the input stream and message digest.
- */
- public String toString()
- {
- return "[Digest Input Stream] " + digest.toString();
- }
-}
Deleted: trunk/core/src/classpath/java/java/security/DigestOutputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/security/DigestOutputStream.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/DigestOutputStream.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,158 +0,0 @@
-/* DigestOutputStream.java --- An output stream tied to a message digest
- Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * DigestOutputStream is a class that ties an OutputStream with a
- * MessageDigest. The Message Digest is used by the class to update it
- * self as bytes are written to the OutputStream.
- *
- * The updating to the digest depends on the on flag which is set to
- * true by default that tells the class to update the data in the
- * message digest.
- *
- * @version 0.0
- * @author Mark Benvenuto (ivy...@wo...)
- */
-public class DigestOutputStream extends FilterOutputStream
-{
- /**
- * The message digest for the DigestOutputStream
- */
- protected MessageDigest digest;
-
- //Manages the on flag
- private boolean state = true;
-
- /**
- * Constructs a new DigestOutputStream. It associates a
- * MessageDigest with the stream to compute the stream as data is
- * written.
- *
- * @param stream An OutputStream to associate this stream with
- * @param digest A MessageDigest to hash the stream with
- */
- public DigestOutputStream(OutputStream stream, MessageDigest digest)
- {
- super(stream);
- this.digest = digest;
- }
-
- /**
- * Returns the MessageDigest associated with this DigestOutputStream
- *
- * @return The MessageDigest used to hash this stream
- */
- public MessageDigest getMessageDigest()
- {
- return digest;
- }
-
- /**
- * Sets the current MessageDigest to current parameter
- *
- * @param digest A MessageDigest to associate with this stream
- */
- public void setMessageDigest(MessageDigest digest)
- {
- this.digest = digest;
- }
-
-
- /**
- * Updates the hash if the on flag is true and then writes a byte to
- * the underlying output stream.
- *
- * @param b A byte to write to the output stream
- *
- * @exception IOException if the underlying output stream
- * cannot write the byte, this is thrown.
- */
- public void write(int b) throws IOException
- {
- if (state)
- digest.update((byte) b);
-
- out.write(b);
- }
-
- /**
- * Updates the hash if the on flag is true and then writes the bytes
- * to the underlying output stream.
- *
- * @param b Bytes to write to the output stream
- * @param off Offset to start to start at in array
- * @param len Length of data to write
- *
- * @exception IOException if the underlying output stream
- * cannot write the bytes, this is thrown.
- */
- public void write(byte[]b, int off, int len) throws IOException
- {
- if (state)
- digest.update(b, off, len);
-
- out.write(b, off, len);
- }
-
- /**
- * Sets the flag specifying if this DigestOutputStream updates the
- * digest in the write() methods. The default is on;
- *
- * @param on True means it digests stream, false means it does not
- */
- public void on(boolean on)
- {
- state = on;
- }
-
- /**
- * Converts the output stream and underlying message digest to a string.
- *
- * @return A string representing the output stream and message digest.
- */
- public String toString()
- {
- return "[Digest Output Stream] " + digest.toString();
- }
-}
Deleted: trunk/core/src/classpath/java/java/security/DummyMessageDigest.java
===================================================================
--- trunk/core/src/classpath/java/java/security/DummyMessageDigest.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/DummyMessageDigest.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,90 +0,0 @@
-/* DummyMessageDigest.java - Wrapper for MessageDigestSpi
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.security;
-
-final class DummyMessageDigest extends MessageDigest
-{
- private MessageDigestSpi mdSpi = null;
-
- public DummyMessageDigest(MessageDigestSpi mdSpi, String algorithm)
- {
- super(algorithm);
- this.mdSpi = mdSpi;
- }
-
- public Object clone() throws CloneNotSupportedException
- {
- MessageDigest result = new DummyMessageDigest
- ((MessageDigestSpi) mdSpi.clone(), this.getAlgorithm());
- result.provider = this.getProvider();
- return result;
- }
-
- // java.security.MessageDigestSpi abstract methods implementation ---------
-
- public byte[] engineDigest()
- {
- return mdSpi.engineDigest();
- }
-
- public int engineDigest(byte[] buf, int offset, int len)
- throws DigestException
- {
- return mdSpi.engineDigest(buf, offset, len);
- }
-
- public int engineGetDigestLength()
- {
- return mdSpi.engineGetDigestLength();
- }
-
- public void engineReset()
- {
- mdSpi.engineReset();
- }
-
- public void engineUpdate(byte input)
- {
- mdSpi.engineUpdate(input);
- }
-
- public void engineUpdate(byte[] input, int offset, int len)
- {
- mdSpi.engineUpdate(input, offset, len);
- }
-}
Deleted: trunk/core/src/classpath/java/java/security/DummySignature.java
===================================================================
--- trunk/core/src/classpath/java/java/security/DummySignature.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/DummySignature.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,102 +0,0 @@
-/* DummySignature.java - Signature wrapper for SignatureSpi.
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.security;
-
-final class DummySignature extends Signature
-{
- private SignatureSpi sigSpi = null;
-
- public DummySignature(SignatureSpi sigSpi, String algorithm)
- {
- super(algorithm);
- this.sigSpi = sigSpi;
- }
-
- public Object clone() throws CloneNotSupportedException
- {
- Signature result = new DummySignature
- ((SignatureSpi) sigSpi.clone(), this.getAlgorithm());
- result.provider = this.getProvider();
- return result;
- }
-
- protected void engineInitVerify(PublicKey publicKey)
- throws InvalidKeyException
- {
- sigSpi.engineInitVerify(publicKey);
- }
-
- protected void engineInitSign(PrivateKey privateKey)
- throws InvalidKeyException
- {
- sigSpi.engineInitSign(privateKey);
- }
-
- protected void engineUpdate(byte b) throws SignatureException
- {
- sigSpi.engineUpdate(b);
- }
-
- protected void engineUpdate(byte[]b, int off, int len)
- throws SignatureException
- {
- sigSpi.engineUpdate(b, off, len);
- }
-
- protected byte[] engineSign() throws SignatureException
- {
- return sigSpi.engineSign();
- }
-
- protected boolean engineVerify(byte[]sigBytes) throws SignatureException
- {
- return sigSpi.engineVerify(sigBytes);
- }
-
- protected void engineSetParameter(String param, Object value)
- throws InvalidParameterException
- {
- sigSpi.engineSetParameter(param, value);
- }
-
- protected Object engineGetParameter(String param)
- throws InvalidParameterException
- {
- return sigSpi.engineGetParameter(param);
- }
-}
Deleted: trunk/core/src/classpath/java/java/security/GuardedObject.java
===================================================================
--- trunk/core/src/classpath/java/java/security/GuardedObject.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/GuardedObject.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,121 +0,0 @@
-/* GuardedObject.java -- An object protected by a Guard
- Copyright (C) 1998, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-
-/**
- * This class is an object that is guarded by a <code>Guard</code> object.
- * The object that is being guarded is retrieved by a call to the only
- * method in this class - <code>getObject</code>. That method returns the
- * guarded <code>Object</code> after first checking with the
- * <code>Guard</code>. If the <code>Guard</code> disallows access, an
- * exception will be thrown.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @since 1.1
- * @status updated to 1.4
- */
-public class GuardedObject implements Serializable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -5240450096227834308L;
-
- /**
- * This is the Guard that is protecting the object.
- *
- * @serial the guard
- */
- private final Guard guard;
-
- /**
- * This is the object that is being guarded.
- *
- * @serial the protected object
- */
- private final Object object;
-
- /**
- * This method initializes a new instance of <code>GuardedObject</code>
- * that protects the specified <code>Object</code> using the specified
- * <code>Guard</code>. A null guard means there are no restrictions on
- * accessing the object.
- *
- * @param object the <code>Object</code> to guard
- * @param guard the <code>Guard</code> that is protecting the object
- */
- public GuardedObject(Object object, Guard guard)
- {
- this.object = object;
- this.guard = guard;
- }
-
- /**
- * This method first call the <code>checkGuard</code> method on the
- * <code>Guard</code> object protecting the guarded object. If the
- * <code>Guard</code> disallows access, an exception is thrown, otherwise
- * the <code>Object</code> is returned.
- *
- * @return The object being guarded
- * @throws SecurityException if access is denied
- */
- public Object getObject()
- {
- if (guard != null)
- guard.checkGuard(object);
- return object;
- }
-
- /**
- * Ensures that serialization is legal, by checking the guard.
- *
- * @param s the stream to write to
- * @throws IOException if the underlying stream fails
- */
- private void writeObject(ObjectOutputStream s) throws IOException
- {
- if (guard != null)
- guard.checkGuard(object);
- s.defaultWriteObject();
- }
-} // class GuardedObject
Deleted: trunk/core/src/classpath/java/java/security/Identity.java
===================================================================
--- trunk/core/src/classpath/java/java/security/Identity.java 2009-02-16 20:38:42 UTC (rev 5035)
+++ trunk/core/src/classpath/java/java/security/Identity.java 2009-02-16 20:41:55 UTC (rev 5036)
@@ -1,346 +0,0 @@
-/* Identity.java --- Identity Class
- Copyright (C) 1999, 2003, Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.security;
-
-import java.io.Serializable;
-import java.util.Vector;
-
-/**
- * The <code>Identity</code> class is used to represent people and companies
- * that can be authenticated using public key encryption. The identities can
- * also be abstract objects such as smart cards.
- *
- * <p><code>Identity</code> objects 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 are unique to that scope.</p>
- *
- * <p>Each identity has a set of ceritificates which all specify the same
- * public key, but not necessarily the same name.</p>
- *
- * <p>The <code>Identity</code> class can be subclassed to allow additional
- * information to be attached to it.</p>
- *
- * @author Mark Benvenuto
- * @see IdentityScope
- * @see Signer
- * @see Principal
- * @deprecated Replaced by <code>java.security.KeyStore</code>, the
- * <code>java.security.cert</code> package, and
- * <code>java.security.Principal</code>.
- */
-public abstract class Identity implements Principal, Serializable
-{
- private static final long serialVersionUID = 3609922007826600659L;
-
- private String name;
- private IdentityScope scope;
- private PublicKey publicKey;
- private String info;
- private Vector certificates;
-
- /** Constructor for serialization only. */
- protected Identity()
- {
- }
-
- /**
- * Constructs a new instance of <code>Identity</code> with the specified
- * name and scope.
- *
- * @param name
- * the name to use.
- * @param scope
- * the scope to use.
- * @throws KeyManagementException
- * if the identity is already present.
- */
- public Identity(String name, IdentityScope scope)
- throws KeyManagementException
- {
- this.name = name;
- this.scope = scope;
- }
-
- /**
- * Constructs a new instance of <code>Identity</code> with the specified
- * name and no scope.
- *
- * @param name
- * the name to use.
- */
- public Identity(String name)
- {
- this.name = name;
- this.scope = null;
- }
-
- /** @return the name of this identity. */
- public final String getName()
- {
- return name;
- }
-
- /** @return the scope of this identity. */
- public final IdentityScope getScope()
- {
- return scope;
- }
-
- /**
- * @return the public key of this identity.
- * @see #setPublicKey(java.security.PublicKey)
- */
- public PublicKey getPublicKey()
- {
- return publicKey;
- }
-
- /**
- * Sets the public key for this identity. The old key and all certificates
- * are removed.
- *
- * @param key
- * the public key to use.
- * @throws KeyManagementException
- * if this public key is used by another identity in the current
- * scope.
- * @throws SecurityException
- * if a {@link SecurityManager} is installed which disallows this
- * operation.
- */
- public void setPublicKey(PublicKey key) throws KeyManagementException
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkSecurityAccess("setIdentityPublicKey");
-
- this.publicKey = key;
- }
-
- /**
- * Sets the general information string.
- *
- * @param info
- * the general information string.
- * @throws SecurityException
- * if a {@link SecurityManager} is installed which disallows this
- * operation.
- */
- public void setInfo(String info)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkSecurityAccess("setIdentityInfo");
-
- this.info = info;
- }
-
- /**
- * @return the general information string of this identity.
- * @see #setInfo(String)
- */
- public String getInfo()
- {
- return info;
- }
-
- /**
- * 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.
- *
- * @param certificate
- * the certificate to add.
- * @throws KeyManagementException
- * if the certificate is invalid, or the public key conflicts.
- * @throws SecurityException
- * if a {@link SecurityManager} is installed which disallows this
- * operation.
- */
- public void addCertificate(Certificate certificate)
- throws KeyManagementException
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkSecurityAccess("addIdentityCertificate");
-
- // Check public key of this certific...
[truncated message content] |