diff options
author | Aaron M. Renn <arenn@urbanophile.com> | 1998-09-01 02:33:10 +0000 |
---|---|---|
committer | Aaron M. Renn <arenn@urbanophile.com> | 1998-09-01 02:33:10 +0000 |
commit | f5de98d1a4f1ca0684709e402f0f7028bb57211a (patch) | |
tree | 1e08d175e27c45ed508f25d3d481c6ba1a547e99 | |
parent | a88ee9eecc24fe2e0d032c4a70c329487c3e522d (diff) | |
download | classpath-f5de98d1a4f1ca0684709e402f0f7028bb57211a.tar.gz |
Initial Checkin
23 files changed, 1517 insertions, 0 deletions
diff --git a/java/security/AccessControlException.java b/java/security/AccessControlException.java new file mode 100644 index 000000000..471634547 --- /dev/null +++ b/java/security/AccessControlException.java @@ -0,0 +1,102 @@ +/************************************************************************* +/* AccessControlException.java -- Permission is denied +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown when the <code>AccessController</code> denies + * an attempt to perform an operation. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class AccessControlException extends SecurityException +{ + +/*************************************************************************/ + +/* + * Instance Variables + */ + +/** + * The <code>Permission</code> associated with this exception + */ +private Permission perm; + +/*************************************************************************/ + +/* + * Constructors + */ + +/** + * This method initializes a new instance of <code>AccessControlException</code> + * with a descriptive error message. There will be no <code>Permission</code> + * object associated with this exception. + * + * @param msg The descriptive error message + */ +public +AccessControlException(String msg) +{ + super(msg); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>AccessControlException</code> + * with a descriptive error message and an instance of <code>Permission</code> + * that is the permission that caused the exception to be thrown. + * + * @param msg The descriptive error message + * @param perm The <code>Permission</code> object that caused this exception. + */ +public +AccessControlException(String msg, Permission perm) +{ + super(msg); + + this.perm = perm; +} + +/*************************************************************************/ + +/* + * Instance Methods + */ + +/** + * This method returns the <code>Permission</code> object that caused + * this exception to be thrown. + * + * @return The requested <code>Permission</code> object, or <code>null</code> if none is available. + */ +public Permission +getPermission() +{ + return(perm); +} + +} // class AccessControlException + diff --git a/java/security/Certificate.java b/java/security/Certificate.java new file mode 100644 index 000000000..a5f8fd528 --- /dev/null +++ b/java/security/Certificate.java @@ -0,0 +1,128 @@ +/************************************************************************* +/* Certificate.java -- Interface for modeling digital certificates +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.IOException; + +/** + * This interface models a digital certificate which verifies the + * authenticity of a party. This class simply allows certificate + * information to be queried, it does not guarantee that the certificate + * is valid. + * <p> + * This class is deprecated in favor of the new java.security.cert package. + * It exists for backward compatibility only. + * + * @deprecated + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public interface Certificate +{ + +/** + * This method returns the <code>Principal</code> that is guaranteeing + * this certificate. + * + * @return The <code>Principal</code> guaranteeing the certificate + */ +public abstract Principal +getGuarantor(); + +/*************************************************************************/ + +/** + * This method returns the <code>Principal</code> being guaranteed by + * this certificate. + * + * @return The <code>Principal</code> guaranteed by this certificate. + */ +public abstract Principal +getPrincipal(); + +/*************************************************************************/ + +/** + * This method returns the public key for the <code>Principal</code> that + * is being guaranteed. + * + * @return The <code>PublicKey</code> of the <code>Principal</code> being guaranteed + */ +public abstract PublicKey +getPublicKey(); + +/*************************************************************************/ + +/** + * This method returns the encoding format of the certificate (e.g., "PGP", + * "X.509"). This format is used by the <code>encode</code. and + * <code>decode</code> methods. + * + * @return The encoding format being used + */ +public abstract String +getFormat(); + +/*************************************************************************/ + +/** + * This method writes the certificate to an <code>OutputStream</code> in + * a format that can be understood by the <code>decode</code> method. + * + * @param out The <code>OutputStream</code> to write to. + * + * @exception KeyException If there is a problem with the internals of this certificate + * @exception IOException If an error occurs writing to the stream. + */ +public abstract void +encode(OutputStream out) throws KeyException, IOException; + +/*************************************************************************/ + +/** + * This method reads an encoded certificate from an <code>InputStream</code>. + * + * @param in The <code>InputStream</code> to read from. + * + * @param KeyException If there is a problem with the certificate data + * @param IOException If an error occurs reading from the stream. + */ +public abstract void +decode(InputStream in) throws KeyException, IOException; + +/*************************************************************************/ + +/** + * This method returns a <code>String</code> representation of the contents + * of this certificate. + * + * @param detail <code>true</code> to provided detailed information about this certificate, <code>false</code> otherwise + */ +public abstract String +toString(boolean detail); + +} // interface Certificate + diff --git a/java/security/DigestException.java b/java/security/DigestException.java new file mode 100644 index 000000000..b378aa41f --- /dev/null +++ b/java/security/DigestException.java @@ -0,0 +1,60 @@ +/************************************************************************* +/* DigestException.java -- A generic message digest exception +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception indicates that a generic message digest exception has + * occurred. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class DigestException extends GeneralSecurityException +{ + +/** + * This method initializes a new <code>DigestException</code> with no + * descriptive message. + */ +public +DigestException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>DigestException</code> + * with a descriptive error message. + * + * @param msg The descriptive message + */ +public +DigestException(String msg) +{ + super(msg); +} + +} // class DigestException + diff --git a/java/security/GeneralSecurityException.java b/java/security/GeneralSecurityException.java new file mode 100644 index 000000000..2db21449c --- /dev/null +++ b/java/security/GeneralSecurityException.java @@ -0,0 +1,65 @@ +/************************************************************************* +/* GeneralSecurityException.java -- Common superclass of security exceptions +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This class is the common superclass of all security exceptions. All + * exceptions in java.security extend this class with the exception (no + * pun intended) of <code>AccessControlException</code> and + * <code>CertificateException</code> which extend <code>SecurityException</code> + * and <code>ProviderException</code> which extens <code>RuntimeException</code>. + * and <code>InvalidParamterException</code> which extends + * <code>IllegalArgumentException</code>. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class GeneralSecurityException extends Exception +{ + +/** + * This method initializes a new instance of <code>GeneralSecurityException</code> + * with no descriptive error message. + */ +public +GeneralSecurityException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>GeneralSecurityException</code> + * with a descriptive error message. + * + * @param msg The descriptive error message. + */ +public +GeneralSecurityException(String msg) +{ + super(msg); +} + +} // class GeneralSecurityException + diff --git a/java/security/Guard.java b/java/security/Guard.java new file mode 100644 index 000000000..a5f28d8f1 --- /dev/null +++ b/java/security/Guard.java @@ -0,0 +1,48 @@ +/************************************************************************* +/* Guard.java -- Check access to a guarded object +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +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/java/security/InvalidAlgorithmParameterException.java b/java/security/InvalidAlgorithmParameterException.java new file mode 100644 index 000000000..0b1b00d84 --- /dev/null +++ b/java/security/InvalidAlgorithmParameterException.java @@ -0,0 +1,62 @@ +/************************************************************************* +/* InvalidAlgorithmParameterException.java -- What it says +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is throw when an invalid parameter is specified for + * a particular security algorithm. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class InvalidAlgorithmParameterException extends GeneralSecurityException +{ + +/** + * This method initializes a new instance of + * <code>InvalidAlgorithmParameterException</code> with no descriptive + * error message. + */ +public +InvalidAlgorithmParameterException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of + * <code>InvalidAlgorithmParameterException</code> with a descriptive + * error message. + * + * @param msg The descriptive error message + */ +public +InvalidAlgorithmParameterException(String msg) +{ + super(msg); +} + +} // class InvalidAlgorithmParameterException + diff --git a/java/security/InvalidKeyException.java b/java/security/InvalidKeyException.java new file mode 100644 index 000000000..461594976 --- /dev/null +++ b/java/security/InvalidKeyException.java @@ -0,0 +1,59 @@ +/************************************************************************* +/* InvalidKeyException.java -- What it says +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown for invalid keys + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class InvalidKeyException extends KeyException +{ + +/** + * This method initializes a new instance of <code>InvalidKeyException</code> + * with no descriptive error message. + */ +public +InvalidKeyException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>InvalidKeyException</code> + * with a descriptive error message. + * + * @param msg The descriptive error message. + */ +public +InvalidKeyException(String msg) +{ + super(msg); +} + +} // class InvalidKeyException + diff --git a/java/security/InvalidParameterException.java b/java/security/InvalidParameterException.java new file mode 100644 index 000000000..b8e37df4d --- /dev/null +++ b/java/security/InvalidParameterException.java @@ -0,0 +1,36 @@ +/************************************************************************* +/* InvalidParameterException.java -- What it says +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown when an invalid parameter is passed to + * a method. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class InvalidParameterException extends IllegalArgumentException +{ + +} // class InvalidParameterException + diff --git a/java/security/Key.java b/java/security/Key.java new file mode 100644 index 000000000..3760f1a10 --- /dev/null +++ b/java/security/Key.java @@ -0,0 +1,92 @@ +/************************************************************************* +/* Key.java -- A abstract representation of a digital key +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +import java.io.Serializable; + +/** + * This interfaces models the base characteristics that all keys must + * have. These are: a key algorithm, an encoded form, and a format used + * to encode the key. Specific key types inherit from this interface. + * <p> + * Note that since this interface extends <code>Serializable</code>, all + * keys may be serialized. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public interface Key extends Serializable +{ + +/*************************************************************************/ + +/* + * Interface Variables + */ + +/** + * The verion identifier used for serialization. + */ +public static final long serialVersionUID = 0L; + +/*************************************************************************/ + +/* + * Instance Methods + */ + +/** + * This method returns the name of the algorithm for this key. This is a + * <code>String</code> such as "RSA". + * + * @return The name of the algorithm in use + */ +public abstract String +getAlgorithm(); + +/*************************************************************************/ + +/** + * This method returns the name of the encoding format for this key. This + * is the name of the ASN.1 data format used for this key, such as + * "X.509" or "PKCS#8". This method returns <code>null</code> if this key + * does not have an encoding format. + * + * @return The name of the encoding format for this key, or <code>null</code> if there is no such format. + */ +public abstract String +getFormat(); + +/*************************************************************************/ + +/** + * This method returns the encoded form of the key. If this key does not + * support encoding, this method returns <code>null</code> + * + * @return The encoded form of the key, or <code>null</code> if no encoded form is available. + */ +public abstract byte[] +getEncoded(); + +} // interface Key + diff --git a/java/security/KeyException.java b/java/security/KeyException.java new file mode 100644 index 000000000..6bce34a46 --- /dev/null +++ b/java/security/KeyException.java @@ -0,0 +1,59 @@ +/************************************************************************* +/* KeyException.java -- Thrown when there is a problem with a key +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown when there is a problem with a key. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class KeyException extends GeneralSecurityException +{ + +/** + * This method initializes a new instance of <code>KeyException</code> + * with no descriptive message. + */ +public +KeyException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>KeyException</code> + * with a descriptive message. + * + * @param msg The descriptive message. + */ +public +KeyException(String msg) +{ + super(msg); +} + +} // class KeyException + diff --git a/java/security/KeyManagementException.java b/java/security/KeyManagementException.java new file mode 100644 index 000000000..9332cfa28 --- /dev/null +++ b/java/security/KeyManagementException.java @@ -0,0 +1,60 @@ +/************************************************************************* +/* KeyManagementException.java -- What it says +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown whenever a problem related to the management of + * security keys is encountered. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class KeyManagementException extends KeyException +{ + +/** + * This method initializes a new instance of <code>KeyManagementException</code> + * with no descriptive error message. + */ +public +KeyManagementException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>KeyManagementException</code> + * with a descriptive error message. + * + * @param msg The descriptive error message + */ +public +KeyManagementException(String msg) +{ + super(msg); +} + +} // class KeyManagementException + diff --git a/java/security/KeyStoreException.java b/java/security/KeyStoreException.java new file mode 100644 index 000000000..0e2774a91 --- /dev/null +++ b/java/security/KeyStoreException.java @@ -0,0 +1,60 @@ +/************************************************************************* +/* KeyStoreException.java -- Indicates a problem with the key store +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * Indicates a problem with the key store. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class KeyStoreException extends GeneralSecurityException +{ + +/** + * This method initializes a new <code>KeyStoreException</code> with no + * detailed error message. + */ +public +KeyStoreException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new <code>KeyStoreException</code> with a + * detailed error message. + * + * @param msg The descriptive error message. + */ +public +KeyStoreException(String msg) +{ + super(msg); +} + + +} // class KeyStoreException + diff --git a/java/security/NoSuchAlgorithmException.java b/java/security/NoSuchAlgorithmException.java new file mode 100644 index 000000000..4f14451c2 --- /dev/null +++ b/java/security/NoSuchAlgorithmException.java @@ -0,0 +1,60 @@ +/************************************************************************* +/* NoSuchAlgorithmException.java -- What it says +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown when the requested security algorithm is + * not available + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class NoSuchAlgorithmException extends GeneralSecurityException +{ + +/** + * This method initializes a new instance of <code>NoSuchAlgorithmException</code> + * with no descriptive error message. + */ +public +NoSuchAlgorithmException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>NoSuchAlgorithmException</code> + * with a descriptive error message. + * + * @param msg The descriptive error message + */ +public +NoSuchAlgorithmException(String msg) +{ + super(msg); +} + +} // class NoSuchAlgorithmException + diff --git a/java/security/NoSuchProviderException.java b/java/security/NoSuchProviderException.java new file mode 100644 index 000000000..dc1fc8798 --- /dev/null +++ b/java/security/NoSuchProviderException.java @@ -0,0 +1,60 @@ +/************************************************************************* +/* NoSuchProviderException.java -- What it says +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown when the requested security provider is + * not available. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class NoSuchProviderException extends GeneralSecurityException +{ + +/** + * This method initializes a new instance of <code>NoSuchProviderException</code> + * with no descriptive error message. + */ +public +NoSuchProviderException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>NoSuchProviderException</code> + * with a descriptive error message. + * + * @param msg The descriptive error message. + */ +public +NoSuchProviderException(String msg) +{ + super(msg); +} + +} // class NoSuchProviderException + diff --git a/java/security/Principal.java b/java/security/Principal.java new file mode 100644 index 000000000..dd5a7b1c1 --- /dev/null +++ b/java/security/Principal.java @@ -0,0 +1,79 @@ +/************************************************************************* +/* Principal.java -- A security entity +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +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/java/security/PrivateKey.java b/java/security/PrivateKey.java new file mode 100644 index 000000000..ef08b980f --- /dev/null +++ b/java/security/PrivateKey.java @@ -0,0 +1,41 @@ +/************************************************************************* +/* PrivateKey.java -- "Super-interface" for all private keys +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This interface specified no methods. In simply provides a common + * super-interface for all algorithm specific private key values. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public interface PrivateKey +{ + +/** + * This is the version id used for serialization + */ +public static final long serialVersionUID = 0L; + +} // interface PrivateKey + diff --git a/java/security/PrivilegedAction.java b/java/security/PrivilegedAction.java new file mode 100644 index 000000000..724898ff0 --- /dev/null +++ b/java/security/PrivilegedAction.java @@ -0,0 +1,48 @@ +/************************************************************************* +/* PrivilegedAction.java -- Perform a privileged action +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This interface specifes a single <code>run</code> method that + * executes a privileged operation. This method is called by + * <code>AccessController.doPrivileged()</code> after that method + * activiates the required privileges. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public interface PrivilegedAction +{ + +/** + * This method performs an operation that requires higher privileges to + * perform. It is called when a section of code invokes + * <code>AccessController.doPrivileged()</code>. + * + * @return obj An implementation dependent return value + */ +public abstract Object +run(); + +} // interface PrivilegedAction + diff --git a/java/security/PrivilegedActionException.java b/java/security/PrivilegedActionException.java new file mode 100644 index 000000000..f973ed03e --- /dev/null +++ b/java/security/PrivilegedActionException.java @@ -0,0 +1,127 @@ +/************************************************************************* +/* PrivilegedActionException.java -- An exception occurred in a privileged action +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +import java.io.PrintStream; +import java.io.PrintWriter; + +/** + * This exception is thrown when an exception is thrown during a + * privileged action being performed with the + * <code>AccessController.doPrivileged()</code> method. It wrappers the + * actual exception thrown in the privileged code. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class PrivilegedActionException extends Exception +{ + +/*************************************************************************/ + +/* + * Instance Variables + */ + +/** + * This is the actual exception that occurred + */ +private Exception e; + +/*************************************************************************/ + +/* + * Constructors + */ + +/** + * This method initializes a new instance of <code>PrivilegedActionException</code> + * that wrappers the specified <code>Exception</code>. + * + * @param e The <code>Exception</code> to wrapper + */ +public +PrivilegedActionException(Exception e) +{ + this.e = e; +} + +/*************************************************************************/ + +/* + * Instance Methods + */ + +/** + * This method returns the underlying <code>Exception</code> that caused + * this exception to be raised. + * + * @return The wrappered <code>Exception</code>. + */ +public Exception +getException() +{ + return(e); +} + +/*************************************************************************/ + +/** + * This method prints the stack trace of the wrappered exception. + */ +public void +printStackTrace() +{ + e.printStackTrace(); +} + +/*************************************************************************/ + +/** + * This method prints the stack trace of the wrappered exception to the + * specified <code>PrintStream</code>. + * + * @param ps The <code>PrintStream</code> to print the stack trace to. + */ +public void +printStackTrace(PrintStream ps) +{ + e.printStackTrace(ps); +} + +/*************************************************************************/ + +/** + * This method prints the stack trace of the wrappered exception to the + * specified <code>PrintWriter</code>. + * + * @param pw The <code>PrintWriter</code> to print the stack trace to. + */ +public void +printStackTrace(PrintWriter pw) +{ + e.printStackTrace(pw); +} + +} // class PrivilegedActionException + diff --git a/java/security/PrivilegedExceptionAction.java b/java/security/PrivilegedExceptionAction.java new file mode 100644 index 000000000..79ccaa427 --- /dev/null +++ b/java/security/PrivilegedExceptionAction.java @@ -0,0 +1,51 @@ +/************************************************************************* +/* PrivilegedExceptionAction.java -- Perform a privileged operation +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This interface defines a method that is called by + * <code>AccessController.doPrivileged()</code> in order to perform a + * privileged operation with higher privileges enabled. This interface + * differs from <code>PrivilegedAction</code> in that the <code>run</code> + * method in this interface may throw a checked exception. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public interface PrivilegedExceptionAction +{ + +/** + * This method performs an operation that requires higher privileges to + * successfully complete. It is called when a section of code invokes + * <code>AccessController.doPrivileged()</code>. + * + * @return obj An implementation defined return value. + * + * @exception Exception An implementation specific exception. + */ +public abstract Object +run() throws Exception; + +} // interface PrivilegedExceptionAction + diff --git a/java/security/ProviderException.java b/java/security/ProviderException.java new file mode 100644 index 000000000..f4738804f --- /dev/null +++ b/java/security/ProviderException.java @@ -0,0 +1,60 @@ +/************************************************************************* +/* ProviderException.java -- Generic security provider runtime exception +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception indicates that a runtime problem was encounterd with + * a security provider. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class ProviderException extends RuntimeException +{ + +/** + * This method initializes a new instance of <code>ProviderException</code> + * with no descriptive error message. + */ +public +ProviderException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>ProviderException</code> + * with a descriptive error message. + * + * @param msg The descriptive error message. + */ +public +ProviderException(String msg) +{ + super(msg); +} + +} // class ProviderException + diff --git a/java/security/PublicKey.java b/java/security/PublicKey.java new file mode 100644 index 000000000..8f4fbfd51 --- /dev/null +++ b/java/security/PublicKey.java @@ -0,0 +1,41 @@ +/************************************************************************* +/* PublicKey.java -- "Super-interface" for all public keys +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This interface specified no methods. In simply provides a common + * super-interface for all algorithm specific public key values. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public interface PublicKey +{ + +/** + * This is the version id used for serialization + */ +public static final long serialVersionUID = 0L; + +} // interface PublicKey + diff --git a/java/security/SignatureException.java b/java/security/SignatureException.java new file mode 100644 index 000000000..68a7cbf23 --- /dev/null +++ b/java/security/SignatureException.java @@ -0,0 +1,58 @@ +/************************************************************************* +/* SignatureException.java -- Generic error in signature +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown when a problem is encountered with a + * digital signature. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class SignatureException extends GeneralSecurityException +{ + +/** + * This method initializes a new instance of <code>SignatureException</code> + * with no descriptive error message. + */ +public +SignatureException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>SignatureException</code> + * with a descriptive error message. + */ +public +SignatureException(String msg) +{ + super(msg); +} + +} // class SignatureException + diff --git a/java/security/UnrecoverableKeyException.java b/java/security/UnrecoverableKeyException.java new file mode 100644 index 000000000..bd1945fbd --- /dev/null +++ b/java/security/UnrecoverableKeyException.java @@ -0,0 +1,61 @@ +/************************************************************************* +/* UnrecoverableKeyException.java -- Cannot recover a key from the key store +/* +/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Written by Aaron M. Renn (arenn@urbanophile.com) +/* +/* This library is free software; you can redistribute it and/or modify +/* it under the terms of the GNU Library General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later verion. +/* +/* This library 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 Library General Public License for more details. +/* +/* You should have received a copy of the GNU Library General Public License +/* along with this library; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +package java.security; + +/** + * This exception is thrown when a key cannot be recovered from the key + * store. + * + * @version 0.0 + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ +public class UnrecoverableKeyException extends GeneralSecurityException +{ + +/** + * This method initializes a new instance of <code>UnrecoverableKeyException</code> + * with no descriptive error message. + */ +public +UnrecoverableKeyException() +{ + super(); +} + +/*************************************************************************/ + +/** + * This method initializes a new instance of <code>UnrecoverableKeyException</code> + * with a descriptive error message. + * + * @param msg The descriptive error message. + */ +public +UnrecoverableKeyException(String msg) +{ + super(msg); +} + + +} // class UnrecoverableKeyException + |