You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/06/25 00:29:30 UTC
svn commit: r416968 -
/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/
Author: ndbeyer
Date: Sat Jun 24 15:29:28 2006
New Revision: 416968
URL: http://svn.apache.org/viewvc?rev=416968&view=rev
Log:
Cleanup, generification and one class per file refactor.
Added:
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermissionCollection.java (with props)
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java (with props)
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermission.java
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermission.java
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Identity.java
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStoreSpi.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermission.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermission.java?rev=416968&r1=416967&r2=416968&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermission.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermission.java Sat Jun 24 15:29:28 2006
@@ -14,19 +14,8 @@
* limitations under the License.
*/
-/**
-* @author Alexey V. Varlamov
-* @version $Revision$
-*/
-
package java.security;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamField;
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
/**
* Subclass of Permission whose instances imply all other permissions. Granting
@@ -40,7 +29,7 @@
*/
private static final long serialVersionUID = -2916474571451318075L;
- // Pemission name
+ // Permission name
private static final String ALL_PERMISSIONS = "<all permissions>";
// Actions name
@@ -48,7 +37,7 @@
/**
* Constructs a new instance of this class. The two argument version is
- * provided for class <code>Policy</code> so that it has a consistant call
+ * provided for class <code>Policy</code> so that it has a consistent call
* pattern across all Permissions. The name and action list are both
* ignored.
*
@@ -71,7 +60,7 @@
/**
* Compares the argument to the receiver, and answers true if they represent
* the <em>same</em> object using a class specific comparison. All
- * AllPermissions are equal to eachother.
+ * AllPermissions are equal to each other.
*
* @param obj
* the object to compare with this object
@@ -129,119 +118,5 @@
*/
public PermissionCollection newPermissionCollection() {
return new AllPermissionCollection();
- }
-}
-
-/**
- * Specific PermissionCollection for storing AllPermissions. All instances of
- * AllPermission are equivalent, so it is enough to store a single added
- * instance.
- *
- */
-
-final class AllPermissionCollection extends PermissionCollection {
-
- /**
- * @com.intel.drl.spec_ref
- */
- private static final long serialVersionUID = -4023755556366636806L;
-
- private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField(
- "all_allowed", Boolean.TYPE), };
-
- // Single element of collection.
- private transient Permission all;
-
- /**
- * Adds an AllPermission to the collection.
- */
- public void add(Permission permission) {
- if (isReadOnly()) {
- throw new SecurityException("collection is read-only");
- }
- if (!(permission instanceof AllPermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
- }
- all = permission;
- }
-
- /**
- * Returns enumeration of the collection.
- */
- public Enumeration elements() {
- return new SingletonEnumeration(all);
- }
-
- /**
- * An auxiliary implementation for enumerating a single object.
- *
- */
- final static class SingletonEnumeration implements Enumeration {
-
- private Object element;
-
- /**
- * Constructor taking the single element.
- */
- public SingletonEnumeration(Object single) {
- element = single;
- }
-
- /**
- * Returns true if the element is not enumerated yet.
- */
- public boolean hasMoreElements() {
- return element != null;
- }
-
- /**
- * Returns the element and clears internal reference to it.
- */
- public Object nextElement() {
- if (element == null) {
- throw new NoSuchElementException("no more elements");
- }
- Object last = element;
- element = null;
- return last;
- }
- }
-
- /**
- * Indicates whether the argument permission is implied by the receiver.
- * AllPermission objects imply all other permissions.
- *
- * @return boolean <code>true</code> if the argument permission is implied
- * by the receiver, and <code>false</code> if it is not.
- * @param permission
- * java.security.Permission the permission to check
- */
- public boolean implies(Permission permission) {
- return all != null;
- }
-
- /**
- * Writes accordingly to expected format:
- * <dl>
- * <dt>boolean all_allowed
- * <dd>This is set to true if this collection is not empty
- * </dl>
- */
- private void writeObject(java.io.ObjectOutputStream out) throws IOException {
- ObjectOutputStream.PutField fields = out.putFields();
- fields.put("all_allowed", all != null);
- out.writeFields();
- }
-
- /**
- * Restores internal state.
- */
- private void readObject(java.io.ObjectInputStream in) throws IOException,
- ClassNotFoundException {
- ObjectInputStream.GetField fields = in.readFields();
- if (fields.get("all_allowed", false)) {
- all = new AllPermission();
- }
}
}
Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermissionCollection.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermissionCollection.java?rev=416968&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermissionCollection.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermissionCollection.java Sat Jun 24 15:29:28 2006
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.security;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+/**
+ * Specific PermissionCollection for storing AllPermissions. All instances of
+ * AllPermission are equivalent, so it is enough to store a single added
+ * instance.
+ *
+ */
+final class AllPermissionCollection extends PermissionCollection {
+
+ /**
+ * @com.intel.drl.spec_ref
+ */
+ private static final long serialVersionUID = -4023755556366636806L;
+
+ private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField(
+ "all_allowed", Boolean.TYPE), };
+
+ // Single element of collection.
+ private transient Permission all;
+
+ /**
+ * Adds an AllPermission to the collection.
+ */
+ public void add(Permission permission) {
+ if (isReadOnly()) {
+ throw new SecurityException("collection is read-only");
+ }
+ if (!(permission instanceof AllPermission)) {
+ throw new IllegalArgumentException("invalid permission: "
+ + permission);
+ }
+ all = permission;
+ }
+
+ /**
+ * Returns enumeration of the collection.
+ */
+ public Enumeration<Permission> elements() {
+ return new SingletonEnumeration<Permission>(all);
+ }
+
+ /**
+ * An auxiliary implementation for enumerating a single object.
+ *
+ */
+ final static class SingletonEnumeration<E> implements Enumeration<E> {
+
+ private E element;
+
+ /**
+ * Constructor taking the single element.
+ */
+ public SingletonEnumeration(E single) {
+ element = single;
+ }
+
+ /**
+ * Returns true if the element is not enumerated yet.
+ */
+ public boolean hasMoreElements() {
+ return element != null;
+ }
+
+ /**
+ * Returns the element and clears internal reference to it.
+ */
+ public E nextElement() {
+ if (element == null) {
+ throw new NoSuchElementException("no more elements");
+ }
+ E last = element;
+ element = null;
+ return last;
+ }
+ }
+
+ /**
+ * Indicates whether the argument permission is implied by the receiver.
+ * AllPermission objects imply all other permissions.
+ *
+ * @return boolean <code>true</code> if the argument permission is implied
+ * by the receiver, and <code>false</code> if it is not.
+ * @param permission
+ * java.security.Permission the permission to check
+ */
+ public boolean implies(Permission permission) {
+ return all != null;
+ }
+
+ /**
+ * Writes accordingly to expected format:
+ * <dl>
+ * <dt>boolean all_allowed
+ * <dd>This is set to true if this collection is not empty
+ * </dl>
+ */
+ private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ ObjectOutputStream.PutField fields = out.putFields();
+ fields.put("all_allowed", all != null);
+ out.writeFields();
+ }
+
+ /**
+ * Restores internal state.
+ */
+ private void readObject(java.io.ObjectInputStream in) throws IOException,
+ ClassNotFoundException {
+ ObjectInputStream.GetField fields = in.readFields();
+ if (fields.get("all_allowed", false)) {
+ all = new AllPermission();
+ }
+ }
+}
\ No newline at end of file
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/AllPermissionCollection.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermission.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermission.java?rev=416968&r1=416967&r2=416968&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermission.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermission.java Sat Jun 24 15:29:28 2006
@@ -22,17 +22,7 @@
package java.security;
import java.io.IOException;
-import java.io.InvalidObjectException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamField;
import java.io.Serializable;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
/**
* Superclass of permissions which have names but no action lists.
@@ -197,175 +187,4 @@
in.defaultReadObject();
checkName(this.getName());
}
-}
-
-/**
- * Specific PermissionCollection for storing BasicPermissions of arbitrary type.
- *
- */
-
-final class BasicPermissionCollection extends PermissionCollection {
-
- /**
- * @com.intel.drl.spec_ref
- */
- private static final long serialVersionUID = 739301742472979399L;
-
- private static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("all_allowed", Boolean.TYPE),
- new ObjectStreamField("permissions", Hashtable.class),
- new ObjectStreamField("permClass", Class.class), };
-
- //should be final, but because of writeObject() cannot be
- private transient Map items = new HashMap();
-
- // tru if this Collection contains a BasicPermission with '*' as its permission name
- private transient boolean allEnabled; // = false;
-
- /**
- * @com.intel.drl.spec_ref
- */
- private Class permClass;
-
- /**
- * Adds a permission to the collection. The first added permission must be a
- * subclass of BasicPermission, next permissions must be of the same class
- * as the first one.
- *
- * @see java.security.PermissionCollection#add(java.security.Permission)
- */
- public void add(Permission permission) {
- if (isReadOnly()) {
- throw new SecurityException("collection is read-only");
- }
- if (permission == null) {
- throw new IllegalArgumentException("invalid permission: null");
- }
-
- Class inClass = permission.getClass();
- if (permClass != null) {
- if (permClass != inClass) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
- }
- } else if( !(permission instanceof BasicPermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
- } else {
- // this is the first element provided that another thread did not add
- synchronized (items) {
- if (permClass != null && inClass != permClass) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
- }
- permClass = inClass;
- }
- }
-
- String name = permission.getName();
- items.put(name, permission);
- allEnabled = allEnabled || (name.length() == 1 && '*' == name.charAt(0));
- }
-
- /**
- * Returns enumeration of contained elements.
- */
- public Enumeration elements() {
- return Collections.enumeration(items.values());
- }
-
- /**
- * Indicates whether the argument permission is implied by the receiver.
- *
- * @return boolean <code>true</code> if the argument permission is implied
- * by the receiver, and <code>false</code> if it is not.
- * @param permission
- * java.security.Permission the permission to check
- */
- public boolean implies(Permission permission) {
- if (permission == null || permission.getClass() != permClass) {
- return false;
- }
- if (allEnabled) {
- return true;
- }
- String checkName = permission.getName();
- //first check direct coincidence
- if (items.containsKey(checkName)) {
- return true;
- }
- //now check if there are suitable wildcards
- //suppose we have "a.b.c", let's check "a.b.*" and "a.*"
- char[] name = checkName.toCharArray();
- //I presume that "a.b.*" does not imply "a.b."
- //so the dot at end is ignored
- int pos = name.length - 2;
- for (; pos >= 0; pos--) {
- if (name[pos] == '.') {
- break;
- }
- }
- while (pos >= 0) {
- name[pos + 1] = '*';
- if (items.containsKey(new String(name, 0, pos + 2))) {
- return true;
- }
- for (--pos; pos >= 0; pos--) {
- if (name[pos] == '.') {
- break;
- }
- }
- }
- return false;
- }
-
- /**
- * Expected format is the following:
- * <dl>
- * <dt>boolean all_allowed
- * <dd>This is set to true if this BasicPermissionCollection contains a
- * BasicPermission with '*' as its permission name.
- * <dt>Class<T> permClass
- * <dd>The class to which all BasicPermissions in this
- * BasicPermissionCollection belongs.
- * <dt>Hashtable<K,V> permissions
- * <dd>The BasicPermissions in this BasicPermissionCollection. All
- * BasicPermissions in the collection must belong to the same class. The
- * Hashtable is indexed by the BasicPermission name; the value of the
- * Hashtable entry is the permission.
- * </dl>
- */
- private void writeObject(java.io.ObjectOutputStream out) throws IOException {
- ObjectOutputStream.PutField fields = out.putFields();
- fields.put("all_allowed", allEnabled);
- fields.put("permissions", new Hashtable(items));
- fields.put("permClass", permClass);
- out.writeFields();
- }
-
- /**
- * Reads the object from stream and checks its consistency: all contained
- * permissions must be of the same subclass of BasicPermission.
- */
- private void readObject(java.io.ObjectInputStream in) throws IOException,
- ClassNotFoundException {
- ObjectInputStream.GetField fields = in.readFields();
-
- items = new HashMap();
- synchronized (items) {
- permClass = (Class)fields.get("permClass", null);
- items.putAll((Map)fields.get("permissions", new Hashtable()));
- for (Iterator iter = items.values().iterator(); iter.hasNext();) {
- if (iter.next().getClass() != permClass) {
- throw new InvalidObjectException(
- "Inconsistent types of contained permissions");
- }
- }
- allEnabled = fields.get("all_allowed", false);
- if (allEnabled && !items.containsKey("*")) {
- throw new InvalidObjectException(
- "Invalid state of wildcard flag");
- }
- }
- }
-}
+}
\ No newline at end of file
Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java?rev=416968&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java Sat Jun 24 15:29:28 2006
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.security;
+
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Specific PermissionCollection for storing BasicPermissions of arbitrary type.
+ *
+ */
+
+final class BasicPermissionCollection extends PermissionCollection {
+
+ private static final long serialVersionUID = 739301742472979399L;
+
+ private static final ObjectStreamField[] serialPersistentFields = {
+ new ObjectStreamField("all_allowed", Boolean.TYPE),
+ new ObjectStreamField("permissions", Hashtable.class),
+ new ObjectStreamField("permClass", Class.class), };
+
+ //should be final, but because of writeObject() cannot be
+ private transient Map<String, Permission> items = new HashMap<String, Permission>();
+
+ // true if this Collection contains a BasicPermission with '*' as its permission name
+ private transient boolean allEnabled; // = false;
+
+ private Class<? extends Permission> permClass;
+
+ /**
+ * Adds a permission to the collection. The first added permission must be a
+ * subclass of BasicPermission, next permissions must be of the same class
+ * as the first one.
+ *
+ * @see java.security.PermissionCollection#add(java.security.Permission)
+ */
+ public void add(Permission permission) {
+ if (isReadOnly()) {
+ throw new SecurityException("collection is read-only");
+ }
+ if (permission == null) {
+ throw new IllegalArgumentException("invalid permission: null");
+ }
+
+ Class<? extends Permission> inClass = permission.getClass();
+ if (permClass != null) {
+ if (permClass != inClass) {
+ throw new IllegalArgumentException("invalid permission: "
+ + permission);
+ }
+ } else if( !(permission instanceof BasicPermission)) {
+ throw new IllegalArgumentException("invalid permission: "
+ + permission);
+ } else {
+ // this is the first element provided that another thread did not add
+ synchronized (items) {
+ if (permClass != null && inClass != permClass) {
+ throw new IllegalArgumentException("invalid permission: "
+ + permission);
+ }
+ permClass = inClass;
+ }
+ }
+
+ String name = permission.getName();
+ items.put(name, permission);
+ allEnabled = allEnabled || (name.length() == 1 && '*' == name.charAt(0));
+ }
+
+ /**
+ * Returns enumeration of contained elements.
+ */
+ public Enumeration<Permission> elements() {
+ return Collections.enumeration(items.values());
+ }
+
+ /**
+ * Indicates whether the argument permission is implied by the receiver.
+ *
+ * @return boolean <code>true</code> if the argument permission is implied
+ * by the receiver, and <code>false</code> if it is not.
+ * @param permission
+ * java.security.Permission the permission to check
+ */
+ public boolean implies(Permission permission) {
+ if (permission == null || permission.getClass() != permClass) {
+ return false;
+ }
+ if (allEnabled) {
+ return true;
+ }
+ String checkName = permission.getName();
+ //first check direct coincidence
+ if (items.containsKey(checkName)) {
+ return true;
+ }
+ //now check if there are suitable wildcards
+ //suppose we have "a.b.c", let's check "a.b.*" and "a.*"
+ char[] name = checkName.toCharArray();
+ //I presume that "a.b.*" does not imply "a.b."
+ //so the dot at end is ignored
+ int pos = name.length - 2;
+ for (; pos >= 0; pos--) {
+ if (name[pos] == '.') {
+ break;
+ }
+ }
+ while (pos >= 0) {
+ name[pos + 1] = '*';
+ if (items.containsKey(new String(name, 0, pos + 2))) {
+ return true;
+ }
+ for (--pos; pos >= 0; pos--) {
+ if (name[pos] == '.') {
+ break;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Expected format is the following:
+ * <dl>
+ * <dt>boolean all_allowed
+ * <dd>This is set to true if this BasicPermissionCollection contains a
+ * BasicPermission with '*' as its permission name.
+ * <dt>Class<T> permClass
+ * <dd>The class to which all BasicPermissions in this
+ * BasicPermissionCollection belongs.
+ * <dt>Hashtable<K,V> permissions
+ * <dd>The BasicPermissions in this BasicPermissionCollection. All
+ * BasicPermissions in the collection must belong to the same class. The
+ * Hashtable is indexed by the BasicPermission name; the value of the
+ * Hashtable entry is the permission.
+ * </dl>
+ */
+ private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ ObjectOutputStream.PutField fields = out.putFields();
+ fields.put("all_allowed", allEnabled);
+ fields.put("permissions", new Hashtable<String, Permission>(items));
+ fields.put("permClass", permClass);
+ out.writeFields();
+ }
+
+ /**
+ * Reads the object from stream and checks its consistency: all contained
+ * permissions must be of the same subclass of BasicPermission.
+ */
+ private void readObject(java.io.ObjectInputStream in) throws IOException,
+ ClassNotFoundException {
+ ObjectInputStream.GetField fields = in.readFields();
+
+ items = new HashMap<String, Permission>();
+ synchronized (items) {
+ permClass = (Class<? extends Permission>)fields.get("permClass", null);
+ items.putAll((Hashtable<String, Permission>) fields.get(
+ "permissions", new Hashtable<String, Permission>()));
+ for (Iterator<Permission> iter = items.values().iterator(); iter.hasNext();) {
+ if (iter.next().getClass() != permClass) {
+ throw new InvalidObjectException(
+ "Inconsistent types of contained permissions");
+ }
+ }
+ allEnabled = fields.get("all_allowed", false);
+ if (allEnabled && !items.containsKey("*")) {
+ throw new InvalidObjectException(
+ "Invalid state of wildcard flag");
+ }
+ }
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java?rev=416968&r1=416967&r2=416968&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java Sat Jun 24 15:29:28 2006
@@ -42,16 +42,8 @@
import org.apache.harmony.security.fortress.PolicyUtils;
-
-/**
- * @com.intel.drl.spec_ref
- */
-
public class CodeSource implements Serializable {
- /**
- * @com.intel.drl.spec_ref
- */
private static final long serialVersionUID = 4977541819976013951L;
// Location of this CodeSource object
@@ -87,9 +79,6 @@
}
}
- /**
- * @com.intel.drl.spec_ref
- */
public CodeSource(URL location, CodeSigner[] signers) {
this.location = location;
if (signers != null) {
@@ -176,18 +165,15 @@
return null;
}
// Extract Certificates from the CodeSigner-s
- ArrayList v = new ArrayList();
+ ArrayList<Certificate> v = new ArrayList<Certificate>();
for (int i = 0; i < signers.length; i++) {
v.addAll(signers[i].getSignerCertPath().getCertificates());
}
- certs = (Certificate[]) v.toArray(new Certificate[v.size()]);
+ certs = v.toArray(new Certificate[v.size()]);
return certs;
}
- /**
- * @com.intel.drl.spec_ref
- */
public final CodeSigner[] getCodeSigners() {
if (signers != null) {
@@ -202,8 +188,8 @@
}
X500Principal prevIssuer = null;
- ArrayList list = new ArrayList(certs.length);
- ArrayList asigners = new ArrayList();
+ ArrayList<Certificate> list = new ArrayList<Certificate>(certs.length);
+ ArrayList<CodeSigner> asigners = new ArrayList<CodeSigner>();
// The presumption is that the chains of certificates are placed
// according to the CertPath agreement:
@@ -261,7 +247,7 @@
// Makes an CertPath from a given List of X509Certificate-s.
// @param list
// @return CertPath, or null if CertPath cannot be made
- private CertPath makeCertPath(List list) {
+ private CertPath makeCertPath(List<? extends Certificate> list) {
if (factory == null) {
try {
factory = CertificateFactory.getInstance("X.509");
@@ -364,13 +350,13 @@
// 1. According to the spec, an empty string will be considered
// as "localhost" in the SocketPermission
- // 2. 'file://' urls will have an empty getHost()
+ // 2. 'file://' URLs will have an empty getHost()
// so, let's make a special processing of localhost-s, I do
// believe this'll improve performance of file:// code sources
//
// Don't have to evaluate both the boolean-s each time.
- // It's better to evalueate them directly under if() statement.
+ // It's better to evaluate them directly under if() statement.
//
// boolean thisIsLocalHost = thisHost.length() == 0 || "localhost".equals(thisHost);
// boolean thatIsLocalHost = thatHost.length() == 0 || "localhost".equals(thatHost);
@@ -429,7 +415,7 @@
.length() - 2))) {
return false;
}
- // no futher separators(s) allowed
+ // no further separators(s) allowed
if (thatFile.indexOf("/", thisFile.length() - 1) != -1) {
return false;
}
@@ -469,8 +455,7 @@
* @return a printable representation for the receiver.
*/
public String toString() {
- //FIXME 1.5 StringBuffer => StringBuilder
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("CodeSource, url=");
buf.append(location == null ? "<null>" : location.toString());
@@ -493,9 +478,6 @@
return buf.toString();
}
- /**
- * @com.intel.drl.spec_ref
- */
private void writeObject(ObjectOutputStream oos) throws IOException {
oos.writeObject(location);
if (certs == null || certs.length == 0) {
@@ -520,16 +502,13 @@
}
}
- /**
- * @com.intel.drl.spec_ref
- */
private void readObject(ObjectInputStream ois) throws IOException,
ClassNotFoundException {
location = (URL) ois.readObject();
int certsCount = ois.readInt();
certs = null;
if (certsCount != 0) {
- certs = new java.security.cert.Certificate[certsCount];
+ certs = new Certificate[certsCount];
for (int i = 0; i < certsCount; i++) {
String type = ois.readUTF();
CertificateFactory factory;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Identity.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Identity.java?rev=416968&r1=416967&r2=416968&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Identity.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Identity.java Sat Jun 24 15:29:28 2006
@@ -26,56 +26,29 @@
import java.util.Arrays;
/**
- * @com.intel.drl.spec_ref
+ *
* @deprecated
*/
public abstract class Identity implements Principal, Serializable {
- /**
- * @com.intel.drl.spec_ref
- */
private static final long serialVersionUID = 3609922007826600659L;
- /**
- * @com.intel.drl.spec_ref
- */
private String name;
- /**
- * @com.intel.drl.spec_ref
- */
private PublicKey publicKey;
- /**
- * @com.intel.drl.spec_ref
- */
private String info = "no additional info";
- /**
- * @com.intel.drl.spec_ref
- */
private IdentityScope scope;
- /**
- * @com.intel.drl.spec_ref
- */
- private Vector certificates;
-
- /**
- * @com.intel.drl.spec_ref
- */
+ private Vector<Certificate> certificates;
+
protected Identity() {
}
- /**
- * @com.intel.drl.spec_ref
- */
public Identity(String name) {
this.name = name;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Identity(String name, IdentityScope scope)
throws KeyManagementException {
this(name);
@@ -85,9 +58,6 @@
}
}
- /**
- * @com.intel.drl.spec_ref
- */
public void addCertificate(Certificate certificate)
throws KeyManagementException {
SecurityManager sm = System.getSecurityManager();
@@ -104,14 +74,14 @@
publicKey = certPK;
}
if (certificates == null) {
- certificates = new Vector();
+ certificates = new Vector<Certificate>();
}
certificates.add(certificate);
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
private static boolean checkKeysEqual(PublicKey pk1, PublicKey pk2) {
// first, they should have the same format
// second, their encoded form must be the same
@@ -130,9 +100,9 @@
return Arrays.equals(pk1.getEncoded(), pk2.getEncoded());
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public void removeCertificate(Certificate certificate)
throws KeyManagementException {
SecurityManager sm = System.getSecurityManager();
@@ -144,9 +114,9 @@
}
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public Certificate[] certificates() {
if (certificates == null) {
return new Certificate[0];
@@ -156,9 +126,9 @@
return ret;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
protected boolean identityEquals(Identity identity) {
if (!name.equals(identity.name)) {
return false;
@@ -171,9 +141,9 @@
return checkKeysEqual(publicKey, identity.publicKey);
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public String toString(boolean detailed) {
String s = toString();
if (detailed) {
@@ -182,16 +152,16 @@
return s;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public final IdentityScope getScope() {
return scope;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public void setPublicKey(PublicKey key) throws KeyManagementException {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
@@ -209,16 +179,16 @@
certificates = null;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public PublicKey getPublicKey() {
return publicKey;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public void setInfo(String info) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
@@ -227,16 +197,16 @@
this.info = info;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public String getInfo() {
return info;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public final boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -252,16 +222,16 @@
return identityEquals(i);
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public final String getName() {
return name;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public int hashCode() {
int hash = 0;
if (name != null) {
@@ -273,9 +243,9 @@
return hash;
}
- /**
- * @com.intel.drl.spec_ref
- */
+
+
+
public String toString() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java?rev=416968&r1=416967&r2=416968&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java Sat Jun 24 15:29:28 2006
@@ -40,11 +40,6 @@
import org.apache.harmony.security.fortress.Engine;
-/**
- * @com.intel.drl.spec_ref
- *
- */
-
public class KeyStore {
// Store KeyStore SERVICE name
@@ -74,10 +69,6 @@
// Store used type
private final String type;
- /**
- * @com.intel.drl.spec_ref
- *
- */
protected KeyStore(KeyStoreSpi keyStoreSpi, Provider provider, String type) {
this.type = type;
this.provider = provider;
@@ -86,9 +77,7 @@
}
/**
- * @com.intel.drl.spec_ref
- *
- * throws NullPointerException if type is null
+ * @throws NullPointerException if type is null
*/
public static KeyStore getInstance(String type) throws KeyStoreException {
if (type == null) {
@@ -105,9 +94,9 @@
}
/**
- * @com.intel.drl.spec_ref
*
- * throws NullPointerException if type is null (instead of
+ *
+ * @throws NullPointerException if type is null (instead of
* NoSuchAlgorithmException) as in 1.4 release
*/
public static KeyStore getInstance(String type, String provider)
@@ -127,7 +116,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* throws NullPointerException if type is null (instead of
* NoSuchAlgorithmException) as in 1.4 release
@@ -154,13 +143,13 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public static final String getDefaultType() {
- String dt = (String) AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ String dt = AccessController.doPrivileged(
+ new PrivilegedAction<String>() {
+ public String run() {
return Security.getProperty(PROPERTYNAME);
}
}
@@ -169,7 +158,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final Provider getProvider() {
@@ -177,7 +166,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final String getType() {
@@ -185,7 +174,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final Key getKey(String alias, char[] password)
@@ -198,7 +187,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final Certificate[] getCertificateChain(String alias)
@@ -210,7 +199,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final Certificate getCertificate(String alias)
@@ -222,7 +211,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final Date getCreationDate(String alias) throws KeyStoreException {
@@ -233,7 +222,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* 1.4.2 and 1.5 releases throw unspecified NullPointerException -
* when alias is null IllegalArgumentException - when password is null
@@ -261,7 +250,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final void setKeyEntry(String alias, byte[] key, Certificate[] chain)
@@ -273,7 +262,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* 1.4.2 and 1.5 releases throw unspecified NullPointerExcedption
* when alias is null
@@ -290,7 +279,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* 1.4.2 and 1.5 releases throw NullPointerExcedption when alias is null
*/
@@ -305,9 +294,7 @@
}
/**
- * @com.intel.drl.spec_ref
*
- * FIXME: update to Enumeration <String>
*/
public final Enumeration<String> aliases() throws KeyStoreException {
if (!isInit) {
@@ -317,7 +304,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* 1.4.2 and 1.5 releases throw unspecified NullPointerException when
* alias is null
@@ -333,7 +320,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final int size() throws KeyStoreException {
@@ -344,7 +331,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* jdk1.4.2 and 1.5 releases throw unspecified NullPointerException
* when alias is null
@@ -360,7 +347,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* jdk1.4.2 and 1.5 releases throw unspecified NullPointerException
* when alias is null
@@ -377,7 +364,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final String getCertificateAlias(Certificate cert)
@@ -389,7 +376,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* throws IOException when stream or password is null
*/
@@ -409,7 +396,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final void store(LoadStoreParameter param) throws KeyStoreException,
@@ -424,7 +411,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final void load(InputStream stream, char[] password)
@@ -434,7 +421,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final void load(LoadStoreParameter param) throws IOException,
@@ -447,7 +434,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public final Entry getEntry(String alias, ProtectionParameter param)
@@ -463,7 +450,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
* 1.5 release throws unspecified NullPointerExcedption when alias or
* entry is null
@@ -483,17 +470,17 @@
}
/**
- * @com.intel.drl.spec_ref
*
- * FIXME: for 1.5 update to Class <? extends KeyStore.Entry>
*/
public final boolean entryInstanceOf(String alias,
Class<? extends KeyStore.Entry> entryClass)
throws KeyStoreException {
- if (alias == null)
+ if (alias == null) {
throw new NullPointerException("alias is null");
- if (entryClass == null)
+ }
+ if (entryClass == null) {
throw new NullPointerException("entryClass is null");
+ }
if (!isInit) {
throw new KeyStoreException(NOTINITKEYSTORE);
@@ -503,40 +490,42 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public abstract static class Builder {
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
protected Builder() {
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public abstract KeyStore getKeyStore() throws KeyStoreException;
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public abstract ProtectionParameter getProtectionParameter(String alise)
throws KeyStoreException;
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public static Builder newInstance(KeyStore keyStore,
ProtectionParameter protectionParameter) {
- if (keyStore == null)
+ if (keyStore == null) {
throw new NullPointerException("keystore is null");
- if (protectionParameter == null)
+ }
+ if (protectionParameter == null) {
throw new NullPointerException("protectionParameter is null");
+ }
if (!keyStore.isInit) {
throw new IllegalArgumentException(NOTINITKEYSTORE);
@@ -546,7 +535,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public static Builder newInstance(String type, Provider provider,
@@ -583,7 +572,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public static Builder newInstance(String type, Provider provider,
@@ -599,11 +588,10 @@
}
/*
- * This class is implemenation of abstract class KeyStore.Builder
+ * This class is implementation of abstract class KeyStore.Builder
*
* @author Vera Petrashkova
*
- * @version
*/
private static class BuilderImpl extends Builder {
// Store used KeyStore
@@ -700,7 +688,7 @@
// load KeyStore from file
AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
+ new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
if (fileForLoad != null) {
FileInputStream fis = null;
@@ -758,8 +746,6 @@
* Implementation of LoadStoreParameter interface
*
* @author Vera Petrashkova
- *
- * @version
*/
private class TmpLSParameter implements LoadStoreParameter {
@@ -784,7 +770,7 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public static class CallbackHandlerProtection implements
@@ -793,7 +779,7 @@
private final CallbackHandler callbackHandler;
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public CallbackHandlerProtection(CallbackHandler handler) {
@@ -804,7 +790,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public CallbackHandler getCallbackHandler() {
@@ -814,7 +800,7 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public static interface Entry {
@@ -822,12 +808,12 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public static interface LoadStoreParameter {
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public ProtectionParameter getProtectionParameter();
@@ -835,17 +821,17 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public static class PasswordProtection implements ProtectionParameter,
Destroyable {
- // Store passwoed
+ // Store password
private char[] password;
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public PasswordProtection(char[] password) {
@@ -853,7 +839,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public synchronized char[] getPassword() {
@@ -864,7 +850,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public synchronized void destroy() throws DestroyFailedException {
@@ -873,7 +859,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public synchronized boolean isDestroyed() {
@@ -883,7 +869,7 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public static interface ProtectionParameter {
@@ -891,7 +877,7 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public static final class PrivateKeyEntry implements Entry {
@@ -902,19 +888,21 @@
private PrivateKey privateKey;
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain) {
- if (privateKey == null)
+ if (privateKey == null) {
throw new NullPointerException("privateKey is null");
- if (chain == null)
+ }
+ if (chain == null) {
throw new NullPointerException("chain is null");
+ }
if (chain.length == 0) {
throw new IllegalArgumentException("chain length equals 0");
}
- // Match algorithm of private key and algorithm of publick key from
+ // Match algorithm of private key and algorithm of public key from
// the end certificate
String s = chain[0].getType();
if (!(chain[0].getPublicKey().getAlgorithm()).equals(privateKey
@@ -938,7 +926,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public PrivateKey getPrivateKey() {
@@ -946,7 +934,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public Certificate[] getCertificateChain() {
@@ -954,7 +942,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public Certificate getCertificate() {
@@ -962,7 +950,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public String toString() {
@@ -980,7 +968,7 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public static final class SecretKeyEntry implements Entry {
@@ -989,7 +977,7 @@
private final SecretKey secretKey;
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public SecretKeyEntry(SecretKey secretKey) {
@@ -1000,7 +988,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public SecretKey getSecretKey() {
@@ -1008,7 +996,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public String toString() {
@@ -1020,7 +1008,7 @@
/**
*
- * @com.intel.drl.spec_ref
+ *
*
*/
public static final class TrustedCertificateEntry implements Entry {
@@ -1029,7 +1017,7 @@
private final Certificate trustCertificate;
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public TrustedCertificateEntry(Certificate trustCertificate) {
@@ -1040,7 +1028,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public Certificate getTrustedCertificate() {
@@ -1048,7 +1036,7 @@
}
/**
- * @com.intel.drl.spec_ref
+ *
*
*/
public String toString() {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStoreSpi.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStoreSpi.java?rev=416968&r1=416967&r2=416968&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStoreSpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStoreSpi.java Sat Jun 24 15:29:28 2006
@@ -32,137 +32,55 @@
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.PasswordCallback;
-/**
- * @com.intel.drl.spec_ref
- *
- */
-
public abstract class KeyStoreSpi {
- /**
- * @com.intel.drl.spec_ref
- *
- */
public KeyStoreSpi() {
}
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract Key engineGetKey(String alias, char[] password)
throws NoSuchAlgorithmException, UnrecoverableKeyException;
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract Certificate[] engineGetCertificateChain(String alias);
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract Certificate engineGetCertificate(String alias);
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract Date engineGetCreationDate(String alias);
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract void engineSetKeyEntry(String alias, Key key,
char[] password, Certificate[] chain) throws KeyStoreException;
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract void engineSetKeyEntry(String alias, byte[] key,
Certificate[] chain) throws KeyStoreException;
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract void engineSetCertificateEntry(String alias,
Certificate cert) throws KeyStoreException;
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract void engineDeleteEntry(String alias)
throws KeyStoreException;
- /**
- * @com.intel.drl.spec_ref
- *
- * FIXME: 1.5 updates are needed Enumeration <String>
- */
public abstract Enumeration<String> engineAliases();
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract boolean engineContainsAlias(String alias);
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract int engineSize();
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract boolean engineIsKeyEntry(String alias);
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract boolean engineIsCertificateEntry(String alias);
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract String engineGetCertificateAlias(Certificate cert);
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract void engineStore(OutputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException;
- /**
- * @com.intel.drl.spec_ref
- *
- */
public void engineStore(KeyStore.LoadStoreParameter param)
throws IOException, NoSuchAlgorithmException, CertificateException {
throw new UnsupportedOperationException("Not Supported operation");
}
- /**
- * @com.intel.drl.spec_ref
- *
- */
public abstract void engineLoad(InputStream stream, char[] password)
throws IOException, NoSuchAlgorithmException, CertificateException;
- /**
- * @com.intel.drl.spec_ref
- *
- */
public void engineLoad(KeyStore.LoadStoreParameter param)
throws IOException, NoSuchAlgorithmException, CertificateException {
if (param == null) {
@@ -197,10 +115,6 @@
"ProtectionParameter is neither PasswordProtection nor CallbackHandlerProtection");
}
- /**
- * @com.intel.drl.spec_ref
- *
- */
public KeyStore.Entry engineGetEntry(String alias,
KeyStore.ProtectionParameter protParam) throws KeyStoreException,
NoSuchAlgorithmException, UnrecoverableEntryException {
@@ -245,10 +159,6 @@
throw new NoSuchAlgorithmException("Unknown KeyStore.Entry object");
}
- /**
- * @com.intel.drl.spec_ref
- *
- */
public void engineSetEntry(String alias, KeyStore.Entry entry,
KeyStore.ProtectionParameter protParam) throws KeyStoreException {
if (entry == null) {
@@ -298,18 +208,13 @@
+ "nor TrustedCertificateEntry: " + entry.toString());
}
- /**
- * @com.intel.drl.spec_ref
- *
- * FIXME: 1.5 updates Class <? extends KeyStore.Entry> should be done
- */
public boolean engineEntryInstanceOf(String alias,
Class<? extends KeyStore.Entry> entryClass) {
if (!engineContainsAlias(alias)) {
return false;
}
- Class cl1 = null;
- Class cl2 = null;
+ Class<?> cl1 = null;
+ Class<?> cl2 = null;
try {
if (engineIsCertificateEntry(alias)) {
cl1 = Class
@@ -333,12 +238,11 @@
}
}
- //
- // This method returns password wich is incapsulated in
- // CallbackHandlerProtection object
- // If there is no implementation of CallbackHandler then
- // this method returns null
- //
+ /*
+ * This method returns password which is encapsulated in
+ * CallbackHandlerProtection object If there is no implementation of
+ * CallbackHandler then this method returns null
+ */
static char[] getPasswordFromCallBack(KeyStore.ProtectionParameter protParam)
throws UnrecoverableEntryException {
if (protParam == null) {
@@ -356,7 +260,7 @@
}
try {
- Class cl = Class.forName(clName);
+ Class<?> cl = Class.forName(clName);
CallbackHandler cbHand = (CallbackHandler) cl.newInstance();
PasswordCallback[] pwCb = { new PasswordCallback("password: ", true) };
cbHand.handle(pwCb);