diff options
Diffstat (limited to 'libjava/java/security')
42 files changed, 0 insertions, 2534 deletions
diff --git a/libjava/java/security/AlgorithmParameterGeneratorSpi.java b/libjava/java/security/AlgorithmParameterGeneratorSpi.java deleted file mode 100644 index 476e1bb40f0..00000000000 --- a/libjava/java/security/AlgorithmParameterGeneratorSpi.java +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 7, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Stubbed. - */ - -// JDK1.2 -public abstract class AlgorithmParameterGeneratorSpi -{ - // FIXME: Stubbed. -} diff --git a/libjava/java/security/BasicPermission.java b/libjava/java/security/BasicPermission.java deleted file mode 100644 index f2e70ed3738..00000000000 --- a/libjava/java/security/BasicPermission.java +++ /dev/null @@ -1,271 +0,0 @@ -/* BasicPermission.java -- Implements a simple named permission. - Copyright (C) 1998, 1999 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -As a special exception, if you link this library with other files to -produce an executable, this library does not by itself cause the -resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why the -executable file might be covered by the GNU General Public License. */ - - -package java.security; - -import java.io.Serializable; -import java.util.Hashtable; -import java.util.Enumeration; - -/** - * 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. - * - * @version 0.1 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public abstract class BasicPermission extends Permission implements Serializable -{ - - /*************************************************************************/ - - /* - * Constructors - */ - - /** - * This method initializes a new instance of <code>BasicPermission</code> - * with the specified name. If the name contains an illegal wildcard - * character, an exception is thrown. - * - * @param name The name of this permission. - * - * @exception IllegalArgumentException If the name contains an invalid wildcard character - * @exception NullPointerException If the name is null - */ - public - BasicPermission(String name) throws IllegalArgumentException, NullPointerException - { - super(name); - - if (name.indexOf("*") != -1) - { - if (!name.endsWith(".*") && !name.equals("*")) - throw new IllegalArgumentException("Bad wildcard: " + name); - - if (name.indexOf("*") != name.lastIndexOf("*")) - throw new IllegalArgumentException("Bad wildcard: " + name); - } - } - - /*************************************************************************/ - - /** - * This method initializes a new instance of <code>BasicPermission</code> - * with the specified name. If the name contains an illegal wildcard - * character, an exception is thrown. The action list passed to this - * form of the constructor is ignored. - * - * @param name The name of this permission. - * @param actions The list of actions for this permission - ignored in this class. - * - * @exception IllegalArgumentException If the name contains an invalid wildcard character - * @exception NullPointerException If the name is null - */ - public - BasicPermission(String name, String actions) throws IllegalArgumentException, NullPointerException - { - // ignore 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: - * <p> - * <ul> - * <li>The specified object is an instance of <code>BasicPermission</code>, - * or a subclass. - * <li>The name of the specified permission is identical to this permission's - * name or the name of the specified permission satisfies a wildcard match - * on this permission. - * </ul> - * - * @param perm The <code>Permission</code> object to test against. - * - * @return <code>true</code> if the specified permission is implied by this one or <code>false</code> otherwise. - */ - public boolean - implies(Permission perm) - { - if (!(perm instanceof BasicPermission)) - return false; - - String otherName = perm.getName(); - String name = getName(); - - if (name.equals(otherName)) - return true; - - int last = name.length() - 1; - if (name.charAt(last) == '*' - && otherName.startsWith(name.substring(0, last))) - return true; - - return false; - } - - /*************************************************************************/ - - /** - * 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: - * <p> - * <ul> - * <li>It is an instance of <code>BasicPermission</code>, or a subclass. - * <li>It has the same name as this permission. - * </ul> - * - * @param obj The <code>Object</code> to test for equality against this object - * - * @return <code>true</code> if the specified <code>Object</code> is equal to this object or <code>false</code> otherwise. - */ - public boolean - equals(Object obj) - { - if (!(obj instanceof BasicPermission)) - return(false); - - if (!getName().equals(((BasicPermission)obj).getName())) - return(false); - - return(true); - } - - /*************************************************************************/ - - /** - * 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. This returns - * be a sub class of <code>PermissionCollection</code> - * that allows for an efficient and consistent implementation of - * the <code>implies</code> method. The collection doesn't handle subclasses - * of BasicPermission correctly; they must override this method. - * - * @return A new empty <code>PermissionCollection</code> object. - */ - public PermissionCollection - newPermissionCollection() - { - return new PermissionCollection() - { - Hashtable permissions = new Hashtable(); - boolean allAllowed = false; - - public void add(Permission permission) - { - if (isReadOnly()) - throw new IllegalStateException("readonly"); - - BasicPermission bp = (BasicPermission) permission; - String name = bp.getName(); - if (name.equals("*")) - allAllowed = true; - permissions.put(name, bp); - } - - public boolean implies(Permission permission) - { - if (!(permission instanceof BasicPermission)) - return false; - - if (allAllowed) - 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) + '*'; - } - } - - public Enumeration elements() - { - return permissions.elements(); - } - }; - } -} // class BasicPermission diff --git a/libjava/java/security/DigestException.java b/libjava/java/security/DigestException.java deleted file mode 100644 index 8c6b2db8af8..00000000000 --- a/libjava/java/security/DigestException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public class DigestException extends GeneralSecurityException -{ - public DigestException() - { - super(); - } - - public DigestException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/DigestOutputStream.java b/libjava/java/security/DigestOutputStream.java deleted file mode 100644 index 8d51278b4d2..00000000000 --- a/libjava/java/security/DigestOutputStream.java +++ /dev/null @@ -1,147 +0,0 @@ -/* DigestOutputStream.java --- An output stream tied to a message digest - Copyright (C) 1999 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -As a special exception, if you link this library with other files to -produce an executable, this library does not by itself cause the -resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why the -executable file might be covered by the GNU General Public License. */ - - -package java.security; - -import java.io.OutputStream; -import java.io.FilterOutputStream; -import java.io.IOException; - -/** - 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 <ivymccough@worldnet.att.net> -*/ -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); - - super.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); - - super.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(); - } -} diff --git a/libjava/java/security/GeneralSecurityException.java b/libjava/java/security/GeneralSecurityException.java deleted file mode 100644 index 9d30737285a..00000000000 --- a/libjava/java/security/GeneralSecurityException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public class GeneralSecurityException extends Exception -{ - public GeneralSecurityException() - { - super(); - } - - public GeneralSecurityException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/Guard.java b/libjava/java/security/Guard.java deleted file mode 100644 index b397dddf207..00000000000 --- a/libjava/java/security/Guard.java +++ /dev/null @@ -1,54 +0,0 @@ -/* Guard.java -- Check access to a guarded object - Copyright (C) 1998 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -As a special exception, if you link this library with other files to -produce an executable, this library does not by itself cause the -resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why the -executable file might be covered by the GNU General Public License. */ - - -package java.security; - -/** - * This interface specifies a mechanism for querying whether or not - * access is allowed to a guarded object. - * - * @version 0.0 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public interface Guard -{ - -/** - * This method tests whether or not access is allowed to the specified - * guarded object. Access is allowed if this method returns silently. If - * access is denied, an exception is generated. - * - * @param obj The <code>Object</code> to test - * - * @exception SecurityException If access to the object is denied. - */ -public abstract void -checkGuard(Object obj) throws SecurityException; - -} // interface Guard - diff --git a/libjava/java/security/InvalidAlgorithmParameterException.java b/libjava/java/security/InvalidAlgorithmParameterException.java deleted file mode 100644 index 35063a961c2..00000000000 --- a/libjava/java/security/InvalidAlgorithmParameterException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 2, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public class InvalidAlgorithmParameterException extends GeneralSecurityException -{ - public InvalidAlgorithmParameterException() - { - super(); - } - - public InvalidAlgorithmParameterException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/InvalidKeyException.java b/libjava/java/security/InvalidKeyException.java deleted file mode 100644 index 3a9a69aade1..00000000000 --- a/libjava/java/security/InvalidKeyException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public class InvalidKeyException extends KeyException -{ - public InvalidKeyException() - { - super(); - } - - public InvalidKeyException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/InvalidParameterException.java b/libjava/java/security/InvalidParameterException.java deleted file mode 100644 index 5ece0126b57..00000000000 --- a/libjava/java/security/InvalidParameterException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public class InvalidParameterException extends IllegalArgumentException -{ - public InvalidParameterException() - { - super(); - } - - public InvalidParameterException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/Key.java b/libjava/java/security/Key.java deleted file mode 100644 index b3f2bef0432..00000000000 --- a/libjava/java/security/Key.java +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; -import java.io.Serializable; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public interface Key extends Serializable -{ - // FIXME: need to set this at some point when serialization is implemented. - // public static final long serialVersionUID = 0L; - - public String getAlgorithm(); - public String getFormat(); - public byte[] getEncoded(); -} diff --git a/libjava/java/security/KeyException.java b/libjava/java/security/KeyException.java deleted file mode 100644 index 634d8ce772e..00000000000 --- a/libjava/java/security/KeyException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public class KeyException extends GeneralSecurityException -{ - public KeyException() - { - super(); - } - - public KeyException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/KeyPair.java b/libjava/java/security/KeyPair.java deleted file mode 100644 index 0aeb7c35792..00000000000 --- a/libjava/java/security/KeyPair.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Tom Tromey <tromey@cygnus.com> - * @date February 9, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public class KeyPair implements java.io.Serializable -{ - public KeyPair (PublicKey publicKey, PrivateKey privateKey) - { - this.publicKey = publicKey; - this.privateKey = privateKey; - } - - public PublicKey getPublic () - { - return publicKey; - } - - public PrivateKey getPrivate () - { - return privateKey; - } - - // The keys. - private PublicKey publicKey; - private PrivateKey privateKey; -} diff --git a/libjava/java/security/KeyPairGenerator.java b/libjava/java/security/KeyPairGenerator.java deleted file mode 100644 index 7954c3270ac..00000000000 --- a/libjava/java/security/KeyPairGenerator.java +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 10, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Partially implemented to the 1.1 spec. - * It is known not to comply with the 1.2 spec. - */ - -public abstract class KeyPairGenerator extends KeyPairGeneratorSpi -{ - protected KeyPairGenerator(String algorithm) - { - name = algorithm; - } - - public static KeyPairGenerator getInstance(String algorithm) - throws NoSuchAlgorithmException - { - String name = "KeyPairGenerator." + algorithm; - Provider[] provs = Security.getProviders(); - for (int i = 0; i < provs.length; ++i) - { - String val = provs[i].getProperty(name); - if (val != null) - { - try - { - return (KeyPairGenerator) Class.forName(val).newInstance(); - } - catch (Throwable _) - { - // We just ignore failures. - } - } - } - - throw new NoSuchAlgorithmException(algorithm); - } - - public static KeyPairGenerator getInstance(String algorithm, String provider) - throws NoSuchAlgorithmException, NoSuchProviderException - { - String name = "KeyPairGenerator." + algorithm; - Provider p = Security.getProvider(provider); - if (p == null) - throw new NoSuchProviderException(provider); - String val = p.getProperty(name); - if (val != null) - { - try - { - return (KeyPairGenerator) Class.forName(val).newInstance(); - } - catch (Throwable _) - { - // Nothing. - } - } - - throw new NoSuchAlgorithmException(algorithm); - } - - public String getAlgorithm() - { - return name; - } - - public abstract void initialize(int strength, SecureRandom random); - public abstract KeyPair generateKeyPair(); - - // Algorithm name. - private String name; -} diff --git a/libjava/java/security/KeyPairGeneratorSpi.java b/libjava/java/security/KeyPairGeneratorSpi.java deleted file mode 100644 index 46520b4aea9..00000000000 --- a/libjava/java/security/KeyPairGeneratorSpi.java +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 7, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Partially implemented. - */ - -// JDK1.2 -public abstract class KeyPairGeneratorSpi -{ - public abstract void initialize(int keysize, SecureRandom random); - public abstract KeyPair generateKeyPair(); -} diff --git a/libjava/java/security/MessageDigest.java b/libjava/java/security/MessageDigest.java deleted file mode 100644 index 04546cdde19..00000000000 --- a/libjava/java/security/MessageDigest.java +++ /dev/null @@ -1,144 +0,0 @@ -// MessageDigest.java - -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Tom Tromey <tromey@cygnus.com> - * @date February 11, 2000. - */ - -/** - * Written using on-line Java Platform 1.1 API Specification. - * Status: Believed complete and correct to 1.1 spec. - * It is known not to comply with the 1.2 spec. - */ - -public abstract class MessageDigest -{ - protected MessageDigest (String algorithm) - { - name = algorithm; - } - - public static MessageDigest getInstance (String algorithm) - throws NoSuchAlgorithmException - { - String name = "MessageDigest." + algorithm; - Provider[] provs = Security.getProviders (); - for (int i = 0; i < provs.length; ++i) - { - String val = provs[i].getProperty (name); - if (val != null) - { - try - { - return (MessageDigest) Class.forName(val).newInstance (); - } - catch (Throwable _) - { - // We just ignore failures. - } - } - } - - throw new NoSuchAlgorithmException (algorithm); - } - - public static MessageDigest getInstance (String algorithm, String provider) - throws NoSuchAlgorithmException, NoSuchProviderException - { - String name = "MessageDigest." + algorithm; - Provider p = Security.getProvider (provider); - if (p == null) - throw new NoSuchProviderException (provider); - String val = p.getProperty (name); - if (val != null) - { - try - { - return (MessageDigest) Class.forName(val).newInstance (); - } - catch (Throwable _) - { - // Nothing. - } - } - - throw new NoSuchAlgorithmException (algorithm); - } - - public void update (byte input) - { - engineUpdate (input); - } - - public void update (byte[] input, int offset, int len) - { - engineUpdate (input, offset, len); - } - - public void update (byte[] input) - { - engineUpdate (input, 0, input.length); - } - - public byte[] digest () - { - return engineDigest (); - } - - public byte[] digest (byte[] input) - { - update (input); - return engineDigest (); - } - - public String toString () - { - // There is no spec for this. - return "[MessageDigest: " + name + "]"; - } - - public static boolean isEqual (byte[] digesta, byte[] digestb) - { - if (digesta == digestb) - return true; - if (digesta.length != digestb.length) - return false; - for (int i = digesta.length - 1; i >= 0; --i) - if (digesta[i] != digestb[i]) - return false; - return true; - } - - public void reset () - { - engineReset (); - } - - public final String getAlgorithm () - { - return name; - } - - protected abstract void engineUpdate (byte input); - protected abstract void engineUpdate (byte input[], int offset, int len); - protected abstract byte[] engineDigest (); - protected abstract void engineReset (); - - public Object clone() throws CloneNotSupportedException - { - return super.clone (); - } - - // Algorithm name. - private String name; -} diff --git a/libjava/java/security/NoSuchAlgorithmException.java b/libjava/java/security/NoSuchAlgorithmException.java deleted file mode 100644 index d51bf32d832..00000000000 --- a/libjava/java/security/NoSuchAlgorithmException.java +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (C) 1999 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -public class NoSuchAlgorithmException extends Exception -{ - public NoSuchAlgorithmException() - { - super(); - } - - public NoSuchAlgorithmException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/NoSuchProviderException.java b/libjava/java/security/NoSuchProviderException.java deleted file mode 100644 index d7d0c853efa..00000000000 --- a/libjava/java/security/NoSuchProviderException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 4, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public class NoSuchProviderException extends GeneralSecurityException -{ - public NoSuchProviderException() - { - super(); - } - - public NoSuchProviderException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/Permission.java b/libjava/java/security/Permission.java deleted file mode 100644 index 620d5b42d2d..00000000000 --- a/libjava/java/security/Permission.java +++ /dev/null @@ -1,191 +0,0 @@ -/* Permission.java -- The superclass for all permission objects - Copyright (C) 1998 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -As a special exception, if you link this library with other files to -produce an executable, this library does not by itself cause the -resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why the -executable file might be covered by the GNU General Public License. */ - - -package java.security; - -import java.io.Serializable; - -/** - * This class is the abstract superclass of all classes that implement - * the concept of a permission. A permission consists of a permission name - * and optionally a list of actions that relate to the permission. The - * actual meaning of the name of the permission is defined only in the - * context of a subclass. It may name a resource to which access permissions - * are granted (for example, the name of a file) or it might represent - * something else entirely. Similarly, the action list only has meaning - * within the context of a subclass. Some permission names may have no - * actions associated with them. That is, you either have the permission - * or you don't. - * - * The most important method in this class is <code>implies</code>. This - * checks whether if one has this permission, then the specified - * permission is also implied. As a conceptual example, consider the - * permissions "Read All Files" and "Read File foo". The permission - * "Read All Files" implies that the caller has permission to read the - * file foo. - * - * <code>Permission</code>'s are not dynamic objects. Once created, a - * <code>Permission</code>'s name and action list cannot be changed. - * - * @version 0.0 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public abstract class Permission implements Guard, Serializable -{ - -/*************************************************************************/ - -/* - * Instance Variables - */ - -/** - * This is the name assigned to this permission object. - */ -protected String name; // Taken from the serializable form information - -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * This method initializes a new instance of <code>Permission</code> to - * have the specified name. - */ -public -Permission(String name) -{ - this.name = name; -} - -/*************************************************************************/ - -/* - * Instance Methods - */ - -/** - * This method returns the name of this <code>Permission</code> - * - * @return The name of this <code>Permission</code> - */ -public String -getName() -{ - return(name); -} - -/*************************************************************************/ - -/** - * This method returns the list of actions for this <code>Permission</code> - * as a <code>String</code>. - * - * @return The action list for this <code>Permission</code>. - */ -public abstract String -getActions(); - -/*************************************************************************/ - -/** - * This method implements the <code>Guard</code> interface for this class. - * It calls the <code>checkPermission</code> method in - * <code>SecurityManager</code> with this <code>Permission</code> as its - * argument. This method returns silently if the security check succeeds - * or throws an exception if it fails. - * - * @param obj The <code>Object</code> being guarded - ignored by this class - * - * @exception SecurityException If the security check fails - */ -public void -checkGuard(Object obj) throws SecurityException -{ - SecurityManager sm = System.getSecurityManager(); -// if (sm != null) -// sm.checkPermission(this); -} - -/*************************************************************************/ - -/** - * This method tests whether this <code>Permission</code> implies that the - * specified <code>Permission</code> is also granted. - * - * @param perm The <code>Permission</code> to test against - * - * @return <code>true</code> if the specified <code>Permission</code> is implied by this one, <code>false</code> otherwise. - */ -public abstract boolean -implies(Permission perm); - -/*************************************************************************/ - -/** - * This method returns a hash code for this <code>Permission</code>. - * - * @return A hash value. - */ -public abstract int -hashCode(); - -/*************************************************************************/ - -/** - * This method returns a <code>String</code> representation of this - * <code>Permission</code> object. - * - * @return This object as a <code>String</code>. - */ -public String -toString() -{ - return("'\"" + getClass().getName() + "\" \"" + getName() + - "\"" + " \"" + getActions() + "\")'"); -} - -/*************************************************************************/ - -/** - * This method returns an empty <code>PermissionCollection</code> object - * that can store permissions of this type, or <code>null</code> if no - * such collection is defined. - * - * @return A new <code>PermissionCollection</code> - */ -public PermissionCollection -newPermissionCollection() -{ - return(null); -} - -} // class Permission - diff --git a/libjava/java/security/PermissionCollection.java b/libjava/java/security/PermissionCollection.java deleted file mode 100644 index 08a9c4987b7..00000000000 --- a/libjava/java/security/PermissionCollection.java +++ /dev/null @@ -1,207 +0,0 @@ -/* PermissionCollection.java -- A collection of permission objects - Copyright (C) 1998 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -As a special exception, if you link this library with other files to -produce an executable, this library does not by itself cause the -resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why the -executable file might be covered by the GNU General Public License. */ - - -package java.security; - -import java.io.Serializable; -import java.util.Enumeration; - -/** - * This class models a group of Java permissions. It has convenient - * methods for determining whether or not a given permission is implied - * by any of the permissions in this collection. - * <p> - * Some care must be taken in storing permissions. First, a collection of - * the appropriate type must be created. This is done by calling the - * <code>newPermissionCollection</code> method on an object of the - * permission class you wish to add to the collection. If this method - * returns <code>null</code>, any type of <code>PermissionCollection</code> - * can be used to store permissions of that type. However, if a - * <code>PermissionCollection</code> collection object is returned, that - * type must be used. - * <p> - * The <code>PermissionCollection</code>'s returned - * by the <code>newPermissionCollection</code> instance in a subclass of - * <code>Permission</code> is a homogeneous collection. It only will - * hold permissions of one specified type - instances of the class that - * created it. Not all <code>PermissionCollection</code> subclasses - * have to hold permissions of only one type however. For example, - * the <code>Permissions</code> class holds permissions of many types. - * <p> - * Since the <code>newPermissionCollection</code> in <code>Permission</code> - * itself returns <code>null</code>, by default a permission can be stored - * in any type of collection unless it overrides that method to create its - * own collection type. - * - * @version 0.0 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public abstract class PermissionCollection extends Object implements Serializable -{ - -/*************************************************************************/ - -/* - * Class Variables - */ - -public static final String linesep = null; - -static -{ - String linesep = System.getProperty("line.separator"); - if (linesep == null); - linesep = "\n"; -} - -/*************************************************************************/ - -/* - * Instance Variables - */ - -/** - * Indicates whether or not this collection is read only. - */ -private boolean readOnly; - -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * This method initializes a new instance of <code>PermissionCollection</code>. - * This is provided only as a default constructor and does nothing in this - * class. - */ -public -PermissionCollection() -{ - ; -} - -/*************************************************************************/ - -/* - * Instance Methods - */ - -/** - * This method tests whether or not this <code>PermissionCollection</code> - * object is read only. - * - * @return <code>true</code> if this collection is read only, <code>false</code> otherwise - */ -public boolean -isReadOnly() -{ - return(readOnly); -} - -/*************************************************************************/ - -/** - * This method sets this <code>PermissionCollection</code> object to be - * read only. No further permissions can be added to it after calling this - * method. - */ -public void -setReadOnly() -{ - readOnly = true; -} - -/*************************************************************************/ - -/** - * This method adds a new <code>Permission</code> object to the collection. - * - * @param perm The <code>Permission</code> to add. - * - * @exception SecurityException If the collection is marked read only. - * @exception IllegalArgumentException If a permission of the specified type cannot be added - */ -public abstract void -add(Permission perm) throws SecurityException, IllegalArgumentException; - -/*************************************************************************/ - -/** - * This method returns an <code>Enumeration</code> of all the objects in - * this collection. - * - * @return An <code>Enumeration</code> of this collection's objects. - */ -public abstract Enumeration -elements(); - -/*************************************************************************/ - -/** - * This method tests whether the specified <code>Permission</code> object is - * implied by this collection of <code>Permission</code> objects. - * - * @param perm The <code>Permission</code> object to test. - * - * @return <code>true</code> if the specified <code>Permission</code> is implied by this collection, <code>false</code> otherwise. - */ -public abstract boolean -implies(Permission perm); - -/*************************************************************************/ - -/** - * This method returns a <code>String</code> representation of this - * collection. It will print the class name and has code in the same - * manner as <code>Object.toString()</code> then print a listing of all - * the <code>Permission</code> objects contained. - * - * @return A <code>String</code> representing this object. - */ -public String -toString() -{ - StringBuffer sb = new StringBuffer(""); - - sb.append(super.toString() + " (" + linesep); - Enumeration e = elements(); - while (e.hasMoreElements()) - { - Object obj = e.nextElement(); - if (obj instanceof Permission) - sb.append(((Permission)obj).toString() + linesep); - } - - sb.append(")" + linesep); - return(sb.toString()); -} - -} // class PermissionCollection - diff --git a/libjava/java/security/Principal.java b/libjava/java/security/Principal.java deleted file mode 100644 index 007ba1a68fd..00000000000 --- a/libjava/java/security/Principal.java +++ /dev/null @@ -1,85 +0,0 @@ -/* Principal.java -- A security entity - Copyright (C) 1998 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -As a special exception, if you link this library with other files to -produce an executable, this library does not by itself cause the -resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why the -executable file might be covered by the GNU General Public License. */ - - -package java.security; - -/** - * This interface models an entity (such as a user or a certificate authority) - * for the purposes of applying the Java security model. - * - * @version 0.0 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public interface Principal -{ - -/** - * This method returns a <code>String</code> that names this - * <code>Principal</code>. - * - * @return The name of this <code>Principal</code>. - */ -public abstract String -getName(); - -/*************************************************************************/ - -/** - * This method tests another <code>Principal</code> object for equality - * with this one. - * - * @param obj The <code>Object</code> (which is a <code>Principal</code>) to test for equality against. - * - * @return <code>true</code> if the specified <code>Principal</code> is equal to this one, <code>false</code> otherwise. - */ -public abstract boolean -equals(Object obj); - -/*************************************************************************/ - -/** - * This method returns a hash code value for this <code>Principal</code>. - * - * @return A hash value - */ -public abstract int -hashCode(); - -/*************************************************************************/ - -/** - * This method returns a <code>String</code> representation of this - * <code>Principal</code>. - * - * @return This <code>Principal</code> represented as a <code>String</code>. - */ -public abstract String -toString(); - -} // interface Principal - diff --git a/libjava/java/security/PrivateKey.java b/libjava/java/security/PrivateKey.java deleted file mode 100644 index 13b9be34b4d..00000000000 --- a/libjava/java/security/PrivateKey.java +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public interface PrivateKey extends Key -{ - // This interface contains no methods or constants. It merely serves - // to group (and provide type safety for) all private key interfaces. -} diff --git a/libjava/java/security/Provider.java b/libjava/java/security/Provider.java deleted file mode 100644 index d0a969f8c5e..00000000000 --- a/libjava/java/security/Provider.java +++ /dev/null @@ -1,197 +0,0 @@ -/* Provider.java -- Security provider information - Copyright (C) 1998, 1999 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., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -As a special exception, if you link this library with other files to -produce an executable, this library does not by itself cause the -resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why the -executable file might be covered by the GNU General Public License. */ - - -package java.security; - -import java.io.Serializable; -import java.util.Properties; - -/** - * This class represents a Java security architecture service provider. - * The services provided by a such a provider can range from security - * algorithms to key generation. - * <p> - * Providers are installed by name and verion number. There is one - * standard provider supplied with the class library. This is the - * "GNU" provider, which can also be accessed by the alias "SUN" for - * compatibility with the JDK. - * - * @version 0.0 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public abstract class Provider extends Properties implements Serializable -{ - -/*************************************************************************/ - -/* - * Instance Variables - */ - -/** - * This is a textual description of the provider - */ -private String info; - -/** - * This is the name of the provider - */ -private String name; - -/** - * This is the version number of the provider - */ -private double version; - -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * This method initializes a new instance of <code>Provider</code> to have - * the specified name, version, and description information. - * - * @param name The name to assign to this <code>Provider</code>. - * @param version The version number for this <code>Provider</code>. - * @param info A textual description of this provider. - */ -protected -Provider(String name, double version, String info) -{ - this.name = name; - this.version = version; - this.info = info; -} - -/*************************************************************************/ - -/* - * Instance Methods - */ - -/** - * This method returns the name assigned to this <code>Provider</code>. - * - * @return The <code>Provider</code>'s name. - */ -public String -getName() -{ - return(name); -} - -/*************************************************************************/ - -/** - * This method retunrs the version number of this <code>Provider</code>. - * - * @return The <code>Provider</code>'s version number. - */ -public double -getVersion() -{ - return(version); -} - -/*************************************************************************/ - -/** - * This method returns a textual description of the <code>Provider</code>. - * - * @return A description of the <code>Provider</code>. - */ -public String -getInfo() -{ - return(info); -} - -/*************************************************************************/ - -/** - * This method sets the specified key to have the specified value. - * - * @param key The property key - * @param value The property value - * - * @return The previous value for this key, or <code>null</code> if no previous value. - */ -public Object -put(Object key, Object value) -{ - return(super.put(key, value)); -} - -/*************************************************************************/ - -/** - * This method removes the specified key entry (and its associated value) - * from the property mapping list. - * - * @param key The key to remove - * - * @return The previous value for this key, or <code>null</code> if no previous value. - */ -public Object -remove(Object key) -{ - return(super.remove(key)); -} - -/*************************************************************************/ - -/** - * This method clears the entire property list such that it no longer - * contains the properties used to look up the services provided by - * the <code>Provider</code>. - */ -public void -clear() -{ - super.clear(); -} - -/*************************************************************************/ - -/** - * This method returns a <code>String</code> representation of this - * object. This will include the <code>Provider</code> name and - * version number. - * - * @return A <code>String</code> representation of this object. - */ -public String -toString() -{ - return(getClass().getName() + ": name=" + getName() + " version=" + version); -} - -} // class Provider - diff --git a/libjava/java/security/PublicKey.java b/libjava/java/security/PublicKey.java deleted file mode 100644 index 5c30c627e31..00000000000 --- a/libjava/java/security/PublicKey.java +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public interface PublicKey extends Key -{ - // This interface contains no methods or constants. It merely serves - // to group (and provide type safety for) all private key interfaces. -} diff --git a/libjava/java/security/SecureClassLoader.java b/libjava/java/security/SecureClassLoader.java deleted file mode 100644 index f49f8ac214c..00000000000 --- a/libjava/java/security/SecureClassLoader.java +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 1998, 1999 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -// JDK1.2 -public class SecureClassLoader extends ClassLoader -{ - public SecureClassLoader () - { - this (null); - } - - public SecureClassLoader (ClassLoader parent) - { - super (parent); - } -} - diff --git a/libjava/java/security/SecureRandom.java b/libjava/java/security/SecureRandom.java deleted file mode 100644 index 6f396dce1e3..00000000000 --- a/libjava/java/security/SecureRandom.java +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; -import java.util.Random; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 7, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Stubbed. - */ - -public class SecureRandom extends Random -{ - // FIXME: Stubbed. -} diff --git a/libjava/java/security/Security.java b/libjava/java/security/Security.java deleted file mode 100644 index 87a0088281b..00000000000 --- a/libjava/java/security/Security.java +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -import java.util.Enumeration; -import java.util.Properties; -import java.util.Vector; - -/** - * @author Tom Tromey <tromey@cygnus.com> - * @date February 8, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Still missing the deprecated getAlgorithmProperty method. - */ - -public final class Security -{ - public static int insertProviderAt (Provider provider, int position) - { - SecurityManager sm = System.getSecurityManager (); - if (sm != null) - { - // FIXME: need SecurityPermission. - // sm.checkSecurityAccess ("insertProvider." + provider.getName ()); - } - if (providers.indexOf (provider) != -1) - return -1; - if (position > providers.size ()) - position = providers.size (); - providers.insertElementAt (provider, position); - return providers.indexOf (provider); - } - - public static int addProvider (Provider provider) - { - return insertProviderAt (provider, providers.size ()); - } - - public static void removeProvider (String name) - { - SecurityManager sm = System.getSecurityManager (); - if (sm != null) - { - // FIXME: need SecurityPermission. - // sm.checkSecurityAccess ("removeProvider." + name); - } - Provider p = getProvider (name); - if (p != null) - providers.removeElement (p); - } - - public static Provider[] getProviders () - { - Provider[] r = new Provider[providers.size ()]; - providers.copyInto (r); - return r; - } - - public static Provider getProvider (String name) - { - Enumeration e = providers.elements (); - while (e.hasMoreElements ()) - { - Provider p = (Provider) e.nextElement (); - if (name.equals (p.getName ())) - return p; - } - return null; - } - - public static String getProperty (String key) - { - SecurityManager sm = System.getSecurityManager (); - if (sm != null) - { - // FIXME: need SecurityPermission. - // sm.checkSecurityAccess ("getProperty." + key); - } - return props.getProperty (key); - } - - public static void setProperty (String key, String value) - { - SecurityManager sm = System.getSecurityManager (); - if (sm != null) - { - // FIXME: need SecurityPermission. - // sm.checkSecurityAccess ("setProperty." + key); - } - props.setProperty (key, value); - } - - // The providers we list. - private static Vector providers = new Vector (); - - // Security propertiesl - private static Properties props = new Properties (); -} diff --git a/libjava/java/security/Signature.java b/libjava/java/security/Signature.java deleted file mode 100644 index 760f62551d8..00000000000 --- a/libjava/java/security/Signature.java +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Tom Tromey <tromey@cygnus.com> - * @date February 11, 2000. - */ - -/** - * Written using on-line Java Platform 1.1 API Specification. - * Status: Believed complete and correct to 1.1 spec. - * It is known not to comply with the 1.2 spec. - */ - -public abstract class Signature -{ - protected Signature (String name) - { - state = UNINITIALIZED; - this.name = name; - } - - public static Signature getInstance (String algorithm) - throws NoSuchAlgorithmException - { - String name = "Signature." + algorithm; - Provider[] provs = Security.getProviders (); - for (int i = 0; i < provs.length; ++i) - { - String val = provs[i].getProperty (name); - if (val != null) - { - try - { - return (Signature) Class.forName(val).newInstance (); - } - catch (Throwable _) - { - // We just ignore failures. - } - } - } - - throw new NoSuchAlgorithmException (algorithm); - } - - public static Signature getInstance (String algorithm, String provider) - throws NoSuchAlgorithmException, NoSuchProviderException - { - String name = "Signature." + algorithm; - Provider p = Security.getProvider (provider); - if (p == null) - throw new NoSuchProviderException (provider); - String val = p.getProperty (name); - if (val != null) - { - try - { - return (Signature) Class.forName(val).newInstance (); - } - catch (Throwable _) - { - // Nothing. - } - } - - throw new NoSuchAlgorithmException (algorithm); - } - - public final void initVerify (PublicKey publicKey) - throws InvalidKeyException - { - engineInitVerify (publicKey); - } - - public final void initSign (PrivateKey privateKey) - throws InvalidKeyException - { - engineInitSign (privateKey); - } - - public final byte[] sign () - throws SignatureException - { - return engineSign (); - } - - public final boolean verify (byte[] signature) - throws SignatureException - { - return engineVerify (signature); - } - - public final void update (byte b) - throws SignatureException - { - engineUpdate (b); - } - - public final void update (byte[] data) - throws SignatureException - { - engineUpdate (data, 0, data.length); - } - - public final void update (byte[] data, int off, int len) - throws SignatureException - { - engineUpdate (data, off, len); - } - - public final String getAlgorithm () - { - return name; - } - - public String toString () - { - // There is no spec for this. FIXME: this is a bad choice. - return name + "; state = " + state; - } - - public final void setParameter (String param, Object value) - throws InvalidParameterException - { - engineSetParameter (param, value); - } - - public final Object getParameter (String param) - throws InvalidParameterException - { - return engineGetParameter (param); - } - - protected abstract void engineInitVerify (PublicKey publicKey) - throws InvalidKeyException; - protected abstract void engineInitSign (PrivateKey privateKey) - throws InvalidKeyException; - protected abstract void engineUpdate (byte b) - throws SignatureException; - protected abstract void engineUpdate (byte[] b, int off, int len) - throws SignatureException; - protected abstract byte[] engineSign () - throws SignatureException; - protected abstract boolean engineVerify (byte[] sigBytes) - throws SignatureException; - protected abstract void engineSetParameter (String param, Object value) - throws InvalidParameterException; - protected abstract Object engineGetParameter (String param) - throws InvalidParameterException; - - public Object clone() throws CloneNotSupportedException - { - return super.clone (); - } - - protected static final int UNINITIALIZED = 0; - protected static final int SIGN = 2; - protected static final int VERIFY = 3; - - // Current state. - protected int state; - - // Name of this object. - private String name; -} diff --git a/libjava/java/security/SignatureException.java b/libjava/java/security/SignatureException.java deleted file mode 100644 index dc1c87a6317..00000000000 --- a/libjava/java/security/SignatureException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/** - * Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public class SignatureException extends GeneralSecurityException -{ - public SignatureException() - { - super(); - } - - public SignatureException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/interfaces/DSAKey.java b/libjava/java/security/interfaces/DSAKey.java deleted file mode 100644 index 3920d7b455a..00000000000 --- a/libjava/java/security/interfaces/DSAKey.java +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.interfaces; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public interface DSAKey -{ - public DSAParams getParams(); -} diff --git a/libjava/java/security/interfaces/DSAParams.java b/libjava/java/security/interfaces/DSAParams.java deleted file mode 100644 index 8483bd5cd2c..00000000000 --- a/libjava/java/security/interfaces/DSAParams.java +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.interfaces; -import java.math.BigInteger; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public interface DSAParams -{ - public BigInteger getP(); - public BigInteger getQ(); - public BigInteger getG(); -} diff --git a/libjava/java/security/interfaces/DSAPrivateKey.java b/libjava/java/security/interfaces/DSAPrivateKey.java deleted file mode 100644 index c0efe21b490..00000000000 --- a/libjava/java/security/interfaces/DSAPrivateKey.java +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.interfaces; -import java.security.PrivateKey; -import java.math.BigInteger; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public interface DSAPrivateKey extends DSAKey, PrivateKey -{ - // FIXME: need to set this at some point when serialization is implemented. - // public static final long serialVersionUID = 0L; - - public BigInteger getX(); -} diff --git a/libjava/java/security/interfaces/DSAPublicKey.java b/libjava/java/security/interfaces/DSAPublicKey.java deleted file mode 100644 index 43eedaf1e84..00000000000 --- a/libjava/java/security/interfaces/DSAPublicKey.java +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.interfaces; -import java.security.PublicKey; -import java.math.BigInteger; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -public interface DSAPublicKey extends DSAKey, PublicKey -{ - // FIXME: need to set this at some point when serialization is implemented. - // public static final long serialVersionUID = 0L; - - public BigInteger getY(); -} diff --git a/libjava/java/security/interfaces/RSAPrivateCrtKey.java b/libjava/java/security/interfaces/RSAPrivateCrtKey.java deleted file mode 100644 index cca294ab4a3..00000000000 --- a/libjava/java/security/interfaces/RSAPrivateCrtKey.java +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.interfaces; -import java.math.BigInteger; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public interface RSAPrivateCrtKey extends RSAPrivateKey -{ - public BigInteger getPublicExponent(); - public BigInteger getPrimeP(); - public BigInteger getPrimeQ(); - public BigInteger getPrimeExponentP(); - public BigInteger getPrimeExponentQ(); - public BigInteger getCrtCoefficient(); -} diff --git a/libjava/java/security/interfaces/RSAPrivateKey.java b/libjava/java/security/interfaces/RSAPrivateKey.java deleted file mode 100644 index 4c16b05e248..00000000000 --- a/libjava/java/security/interfaces/RSAPrivateKey.java +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.interfaces; -import java.security.PrivateKey; -import java.math.BigInteger; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public interface RSAPrivateKey extends PrivateKey -{ - public BigInteger getModulus(); - public BigInteger getPrivateExponent(); -} diff --git a/libjava/java/security/interfaces/RSAPublicKey.java b/libjava/java/security/interfaces/RSAPublicKey.java deleted file mode 100644 index 0bee88df91c..00000000000 --- a/libjava/java/security/interfaces/RSAPublicKey.java +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.interfaces; -import java.security.PublicKey; -import java.math.BigInteger; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public interface RSAPublicKey extends PublicKey -{ - public BigInteger getModulus(); - public BigInteger getPublicExponent(); -} diff --git a/libjava/java/security/spec/AlgorithmParameterSpec.java b/libjava/java/security/spec/AlgorithmParameterSpec.java deleted file mode 100644 index 5781623b746..00000000000 --- a/libjava/java/security/spec/AlgorithmParameterSpec.java +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.spec; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public interface AlgorithmParameterSpec -{ - // This interface contains no methods or constants. Its only purpose is - // to group (and provide type safety for) all key specifications. -} diff --git a/libjava/java/security/spec/InvalidKeySpecException.java b/libjava/java/security/spec/InvalidKeySpecException.java deleted file mode 100644 index 632fd251e7a..00000000000 --- a/libjava/java/security/spec/InvalidKeySpecException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.spec; -import java.security.GeneralSecurityException; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public class InvalidKeySpecException extends GeneralSecurityException -{ - public InvalidKeySpecException() - { - super(); - } - - public InvalidKeySpecException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/spec/InvalidParameterSpecException.java b/libjava/java/security/spec/InvalidParameterSpecException.java deleted file mode 100644 index 1e2aff5c3f6..00000000000 --- a/libjava/java/security/spec/InvalidParameterSpecException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.spec; -import java.security.GeneralSecurityException; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public class InvalidParameterSpecException extends GeneralSecurityException -{ - public InvalidParameterSpecException() - { - super(); - } - - public InvalidParameterSpecException(String msg) - { - super(msg); - } -} diff --git a/libjava/java/security/spec/KeySpec.java b/libjava/java/security/spec/KeySpec.java deleted file mode 100644 index 75e50f9f656..00000000000 --- a/libjava/java/security/spec/KeySpec.java +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.spec; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 1, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Believed complete and correct. - */ - -// JDK1.2 -public interface KeySpec -{ - // This interface contains no methods or constants. Its only purpose is - // to group (and provide type safety for) all key specifications. -} diff --git a/libjava/java/security/spec/RSAPrivateCrtKeySpec.java b/libjava/java/security/spec/RSAPrivateCrtKeySpec.java deleted file mode 100644 index 6a31163c09e..00000000000 --- a/libjava/java/security/spec/RSAPrivateCrtKeySpec.java +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.spec; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 7, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Stubbed. - */ - -// JDK1.2 -public class RSAPrivateCrtKeySpec extends RSAPrivateKeySpec -{ -} diff --git a/libjava/java/security/spec/RSAPrivateKeySpec.java b/libjava/java/security/spec/RSAPrivateKeySpec.java deleted file mode 100644 index 4f38a2d0ba5..00000000000 --- a/libjava/java/security/spec/RSAPrivateKeySpec.java +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.spec; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 7, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Stubbed. - */ - -// JDK1.2 -public class RSAPrivateKeySpec implements KeySpec -{ -} diff --git a/libjava/java/security/spec/RSAPublicKeySpec.java b/libjava/java/security/spec/RSAPublicKeySpec.java deleted file mode 100644 index 0bdcd22922e..00000000000 --- a/libjava/java/security/spec/RSAPublicKeySpec.java +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - -package java.security.spec; - -/** - * @author Warren Levy <warrenl@cygnus.com> - * @date February 10, 2000. - */ - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: Stubbed. - */ - -// JDK1.2 -public class RSAPublicKeySpec implements KeySpec -{ -} |