>From 6b6b00ad303da9d2e5a5c2a0dbaa1eac3c8e93d4 Mon Sep 17 00:00:00 2001
From: Adam Young <ayoung@redhat.com>
Date: Wed, 16 Nov 2011 16:05:21 -0500
Subject: [PATCH 32/38] util type safety cleanup

util type safety cleanup
---
 .../x509/CRLDistributionPointsExtension.java       |   12 +-
 .../x509/CertificatePoliciesExtension.java         |   21 +-
 .../security/x509/CertificatePolicySet.java        |    6 +-
 .../security/x509/FreshestCRLExtension.java        |   11 +-
 .../src/netscape/security/x509/GeneralNames.java   |    4 +-
 .../netscape/security/x509/GeneralSubtrees.java    |   10 +-
 .../security/x509/LdapV3DNStrConverter.java        |    8 +-
 .../netscape/security/x509/NoticeReference.java    |    4 +-
 .../util/src/netscape/security/x509/OIDMap.java    |   28 +-
 .../security/x509/PolicyMappingsExtension.java     |   18 +-
 .../netscape/security/x509/PolicyQualifiers.java   |    8 +-
 pki/base/util/src/netscape/security/x509/RDN.java  |   10 +-
 .../netscape/security/x509/RevokedCertImpl.java    |  680 ++++++++++----------
 .../x509/SubjectDirAttributesExtension.java        |   12 +-
 .../util/src/netscape/security/x509/X500Name.java  |    8 +-
 .../netscape/security/x509/X500NameAttrMap.java    |   24 +-
 .../src/netscape/security/x509/X509CertImpl.java   |    8 +-
 .../util/src/netscape/security/x509/X509Key.java   |    2 +-
 18 files changed, 446 insertions(+), 428 deletions(-)

diff --git a/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java b/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java
index aa8c20b822a511ba97d3159e49b6283d219de9ff..0f64c58b45e56f3b801273823d224f0a9b1089b8 100644
--- a/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java
+++ b/pki/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java
@@ -319,11 +319,11 @@ public class CRLDistributionPointsExtension extends Extension
 		    list.addElement(this);
         }
 
-        private static Hashtable map = new Hashtable();
-	    private static Vector list = new Vector();
+        private static Hashtable<String, Reason> map = new Hashtable<String, Reason>();
+	    private static Vector<Reason> list = new Vector<Reason>();
 
         public static Reason fromString(String name) {
-            return (Reason) map.get(name);
+            return  map.get(name);
         }
 
         public String getName() {
@@ -359,9 +359,9 @@ public class CRLDistributionPointsExtension extends Extension
 	    public static Reason[] bitArrayToReasonArray(byte[] bitFlags) {
 		    byte first = bitFlags[0];
 		    int size = list.size();
-		    Vector result = new Vector();
+		    Vector<Reason> result = new Vector<Reason>();
 		    for(int i = 0; i < size; i++) {
-			    Reason r = (Reason) list.elementAt(i);
+			    Reason r =  list.elementAt(i);
 			    byte b = r.getBitMask();
 			    if( (first & b) != 0 ) {
 				    result.addElement(r);
@@ -370,7 +370,7 @@ public class CRLDistributionPointsExtension extends Extension
 		    size = result.size();
 		    Reason[] retval = new Reason[size];
 		    for(int i=0; i < size; i++) {
-			    retval[i] = (Reason) result.elementAt(i);
+			    retval[i] =  result.elementAt(i);
 		    }
 		    return retval;
 	    }
diff --git a/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java b/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java
index 106cc4500f835ac9406e86e2599cb6bec0b9540e..4c3c4fa08311ca006054b8b745a5a3cb6c4656e1 100644
--- a/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java
+++ b/pki/base/util/src/netscape/security/x509/CertificatePoliciesExtension.java
@@ -70,7 +70,7 @@ implements CertAttrSet {
 
 
     // Private data members 
-    private Vector mInfos;
+    private Vector<CertificatePolicyInfo> mInfos;
  
     // Encode this extension value
     private void encodeThis() throws IOException {
@@ -84,7 +84,7 @@ implements CertAttrSet {
         extensionValue = os.toByteArray();
     }
 
-    public CertificatePoliciesExtension(boolean critical, Vector infos) throws IOException {
+    public CertificatePoliciesExtension(boolean critical, Vector<CertificatePolicyInfo> infos) throws IOException {
         this.mInfos = infos;
         this.extensionId = PKIXExtensions.CertificatePolicies_Id;
         this.critical = critical;
@@ -96,7 +96,7 @@ implements CertAttrSet {
      *
      * @param infos the Vector of CertificatePolicyInfo.
      */
-    public CertificatePoliciesExtension(Vector infos) throws IOException {
+    public CertificatePoliciesExtension(Vector<CertificatePolicyInfo> infos) throws IOException {
         this.mInfos = infos;
         this.extensionId = PKIXExtensions.CertificatePolicies_Id;
         this.critical = false;
@@ -109,7 +109,7 @@ implements CertAttrSet {
 	public CertificatePoliciesExtension() {
         this.extensionId = PKIXExtensions.CertificatePolicies_Id; 
         critical = false;
-        mInfos  = new Vector(1,1);
+        mInfos  = new Vector<CertificatePolicyInfo>(1,1);
     }
 
     /**
@@ -135,7 +135,7 @@ implements CertAttrSet {
             throw new IOException("Invalid encoding for " +
                                   "CertificatePoliciesExtension.");
         }
-        mInfos = new Vector(1, 1);
+        mInfos = new Vector<CertificatePolicyInfo>(1, 1);
         while (val.data.available() != 0) {
             DerValue seq = val.data.getDerValue();
             CertificatePolicyInfo info = new CertificatePolicyInfo(seq);
@@ -184,14 +184,15 @@ implements CertAttrSet {
     /**
      * Set the attribute value.
      */
-    public void set(String name, Object obj) throws IOException {
+    @SuppressWarnings("unchecked")
+	public void set(String name, Object obj) throws IOException {
         clearValue();
         if (name.equalsIgnoreCase(INFOS)) {
             if (!(obj instanceof Vector)) {
               throw new IOException("Attribute value should be of" +
                                     " type Vector.");
             }
-            mInfos = (Vector)obj;
+            mInfos = (Vector<CertificatePolicyInfo>)obj;
         } else {
           throw new IOException("Attribute name not recognized by " +
                         "CertAttrSet:CertificatePoliciesExtension.");
@@ -226,8 +227,8 @@ implements CertAttrSet {
      * Return an enumeration of names of attributes existing within this
      * attribute.
      */
-    public Enumeration getElements () {
-        Vector elements = new Vector();
+    public Enumeration<Vector<CertificatePolicyInfo>> getElements () {
+        Vector<Vector<CertificatePolicyInfo>> elements = new Vector<Vector<CertificatePolicyInfo>>();
         elements.addElement(mInfos);
         return (elements.elements());
     }
@@ -312,7 +313,7 @@ implements CertAttrSet {
 		qualifiers1.add(qualifierInfo1);
 		CertificatePolicyInfo info1 = new CertificatePolicyInfo(
 			plcyId1, qualifiers1);
-		Vector infos = new Vector();
+		Vector<CertificatePolicyInfo> infos = new Vector<CertificatePolicyInfo>();
 		infos.addElement(info0);
 		infos.addElement(info1);
 		try {
diff --git a/pki/base/util/src/netscape/security/x509/CertificatePolicySet.java b/pki/base/util/src/netscape/security/x509/CertificatePolicySet.java
index eaf2151412f63283db911398cbf125dfb617d37f..fafa7764d0c490d40821f3471d93451e0ff93135 100644
--- a/pki/base/util/src/netscape/security/x509/CertificatePolicySet.java
+++ b/pki/base/util/src/netscape/security/x509/CertificatePolicySet.java
@@ -32,14 +32,14 @@ import netscape.security.util.DerValue;
  * @version 1.4
  */
 public class CertificatePolicySet {
-    private Vector	ids;
+    private Vector<CertificatePolicyId>	ids;
 
     /**
      * The default constructor for this class.
      *
      * @param ids the sequence of CertificatePolicyId's.
      */
-    public CertificatePolicySet(Vector ids) {
+    public CertificatePolicySet(Vector<CertificatePolicyId> ids) {
         this.ids = ids;
     }
 
@@ -50,7 +50,7 @@ public class CertificatePolicySet {
      * @exception IOException on decoding errors.
      */
     public CertificatePolicySet(DerInputStream in) throws IOException {
-        ids = new Vector(1, 1);
+        ids = new Vector<CertificatePolicyId>(1, 1);
         DerValue[] seq = in.getSequence(5);
  
         for (int i = 0; i < seq.length; i++) {
diff --git a/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java b/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java
index ac8e2504fcbdac80db644dfeaff82a6160bdc213..dd4bdd17236d49bdfeafdc5c08317b724fe89596 100644
--- a/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java
+++ b/pki/base/util/src/netscape/security/x509/FreshestCRLExtension.java
@@ -29,6 +29,7 @@ import java.util.Vector;
 
 import netscape.security.util.BitArray;
 import netscape.security.util.DerOutputStream;
+import netscape.security.x509.FreshestCRLExtension.Reason;
 
 import org.mozilla.jss.asn1.ASN1Util;
 import org.mozilla.jss.asn1.InvalidBERException;
@@ -324,11 +325,11 @@ public class FreshestCRLExtension extends Extension
 		    list.addElement(this);
         }
 
-        private static Hashtable map = new Hashtable();
-	    private static Vector list = new Vector();
+        private static Hashtable<String, Reason> map = new Hashtable<String, Reason>();
+	    private static Vector<Reason> list = new Vector<Reason>();
 
         public static Reason fromString(String name) {
-            return (Reason) map.get(name);
+            return  map.get(name);
         }
 
         public String getName() {
@@ -364,7 +365,7 @@ public class FreshestCRLExtension extends Extension
 	    public static Reason[] bitArrayToReasonArray(byte[] bitFlags) {
 		    byte first = bitFlags[0];
 		    int size = list.size();
-		    Vector result = new Vector();
+		    Vector<Reason> result = new Vector<Reason>();
 		    for(int i = 0; i < size; i++) {
 			    Reason r = (Reason) list.elementAt(i);
 			    byte b = r.getBitMask();
@@ -375,7 +376,7 @@ public class FreshestCRLExtension extends Extension
 		    size = result.size();
 		    Reason[] retval = new Reason[size];
 		    for(int i=0; i < size; i++) {
-			    retval[i] = (Reason) result.elementAt(i);
+			    retval[i] = result.elementAt(i);
 		    }
 		    return retval;
 	    }
diff --git a/pki/base/util/src/netscape/security/x509/GeneralNames.java b/pki/base/util/src/netscape/security/x509/GeneralNames.java
index 767e0fe3e11589cb2a009d83547fb053975c88c9..d647dd96e30f47105b7862e72bce4ccd93e09691 100644
--- a/pki/base/util/src/netscape/security/x509/GeneralNames.java
+++ b/pki/base/util/src/netscape/security/x509/GeneralNames.java
@@ -35,7 +35,7 @@ import netscape.security.util.DerValue;
  * @author Hemma Prafullchandra
  * @version 1.7
  */
-public class GeneralNames extends Vector {
+public class GeneralNames extends Vector<GeneralNameInterface> {
     /**
      *
      */
@@ -107,7 +107,7 @@ public class GeneralNames extends Vector {
     throws IOException, GeneralNamesException {
         if (size() == 0) { return; }
 
-        Enumeration names = elements();
+        Enumeration<GeneralNameInterface> names = elements();
         DerOutputStream temp = new DerOutputStream();
 
         while (names.hasMoreElements()) {
diff --git a/pki/base/util/src/netscape/security/x509/GeneralSubtrees.java b/pki/base/util/src/netscape/security/x509/GeneralSubtrees.java
index 332f61cdd89291fd0fed4683580669fd99c7eca0..840fdf9e5d423e61e07ba42c3eb89fd852588d26 100644
--- a/pki/base/util/src/netscape/security/x509/GeneralSubtrees.java
+++ b/pki/base/util/src/netscape/security/x509/GeneralSubtrees.java
@@ -34,7 +34,7 @@ import netscape.security.util.PrettyPrintFormat;
  * @author Hemma Prafullchandra
  */
 public class GeneralSubtrees {
-    private Vector	trees;
+    private Vector<GeneralSubtree>	trees;
     private PrettyPrintFormat pp = new PrettyPrintFormat(":");
 
     /**
@@ -42,7 +42,7 @@ public class GeneralSubtrees {
      *
      * @param trees the sequence of GeneralSubtree.
      */
-    public GeneralSubtrees(Vector trees) {
+    public GeneralSubtrees(Vector<GeneralSubtree> trees) {
         this.trees = trees;
     }
 
@@ -52,7 +52,7 @@ public class GeneralSubtrees {
      * @param val the DER encoded form of the same.
      */
     public GeneralSubtrees(DerValue val) throws IOException {
-        trees = new Vector(1, 1);
+        trees = new Vector<GeneralSubtree>(1, 1);
         if (val.tag != DerValue.tag_Sequence) {
             throw new IOException("Invalid encoding of GeneralSubtrees.");
         }
@@ -78,7 +78,7 @@ public class GeneralSubtrees {
         String s = "";
 	GeneralSubtree element;
 
-	for (Enumeration e = trees.elements() ; e.hasMoreElements() ;) {
+	for (Enumeration<GeneralSubtree> e = trees.elements() ; e.hasMoreElements() ;) {
 		element = (GeneralSubtree) e.nextElement();		
 		s = s + pp.indent(indent+4)+ element.toPrint(indent) +"\n";
 	}
@@ -100,7 +100,7 @@ public class GeneralSubtrees {
         out.write(DerValue.tag_Sequence,seq);
     }
 
-    public Vector getSubtrees() {
+    public Vector<GeneralSubtree> getSubtrees() {
         return trees;
     }
 }
diff --git a/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java b/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java
index 8203d9b085e4fa3687eabd7724190a879036bed0..114cc64a1440280b4ce1049070bdb7579c2b994d 100644
--- a/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java
+++ b/pki/base/util/src/netscape/security/x509/LdapV3DNStrConverter.java
@@ -108,7 +108,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter
     {
 	StringReader dn_reader = new StringReader(dn);
 	PushbackReader in = new PushbackReader(dn_reader, 5);
-	Vector rdnVector = new Vector();
+	Vector<RDN> rdnVector = new Vector<RDN>();
         RDN[] names;
 
 	return parseDN(in, encodingOrder);
@@ -136,7 +136,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter
     {
 	StringReader rdn_reader = new StringReader(rdn);
 	PushbackReader in = new PushbackReader(rdn_reader, 5);
-	Vector avaVector = new Vector();
+	Vector<AVA> avaVector = new Vector<AVA>();
         AVA[] assertion;
 
 	return parseRDN(in, null);
@@ -197,7 +197,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter
     {
 	RDN rdn;
 	int lastChar;
-        Vector rdnVector = new Vector();
+        Vector<RDN> rdnVector = new Vector<RDN>();
 	RDN names[];
         int i,j;
 
@@ -240,7 +240,7 @@ public class LdapV3DNStrConverter extends LdapDNStrConverter
     public RDN parseRDN(PushbackReader in, byte[] encodingOrder)
 	throws IOException
     {
-	Vector avaVector = new Vector();
+	Vector<AVA> avaVector = new Vector<AVA>();
 	AVA ava;
 	int lastChar;
 	AVA assertion[];
diff --git a/pki/base/util/src/netscape/security/x509/NoticeReference.java b/pki/base/util/src/netscape/security/x509/NoticeReference.java
index 9098d8163b97b772d1e74f0850cd12479cd6db8e..9c232f3ca597067b554bff4d1280e56b3051da98 100644
--- a/pki/base/util/src/netscape/security/x509/NoticeReference.java
+++ b/pki/base/util/src/netscape/security/x509/NoticeReference.java
@@ -54,7 +54,7 @@ public class NoticeReference {
         if (integers.tag != DerValue.tag_Sequence) {
             throw new IOException("Invalid encoding for NoticeReference (integers)");
         }
-	Vector num = new Vector();
+	Vector<BigInt> num = new Vector<BigInt>();
         while (integers.data.available() != 0) {
            DerValue i = integers.data.getDerValue();
 	   BigInt bigI = i.getInteger();
@@ -64,7 +64,7 @@ public class NoticeReference {
 		return;
 	mNumbers = new int[num.size()];
 	for (int i = 0; i < num.size(); i++) {
-		mNumbers[i] = ((BigInt)num.elementAt(i)).toInt();
+		mNumbers[i] = num.elementAt(i).toInt();
 	}
     }
 
diff --git a/pki/base/util/src/netscape/security/x509/OIDMap.java b/pki/base/util/src/netscape/security/x509/OIDMap.java
index 082ecc4fd31630dca2e471ff3017917083c2a2f7..be1e088e8f98fae4c22c7077d25b00459ee44b31 100644
--- a/pki/base/util/src/netscape/security/x509/OIDMap.java
+++ b/pki/base/util/src/netscape/security/x509/OIDMap.java
@@ -21,8 +21,8 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.security.cert.CertificateException;
-import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.Properties;
 
 import netscape.security.util.ObjectIdentifier;
@@ -91,9 +91,9 @@ public class OIDMap {
     private static final String CRL_REASON  = ROOT + "." +
                                           CRLReasonExtension.NAME;
 
-    private static final Hashtable oid2Name = new Hashtable();
-    private static final Hashtable name2OID = new Hashtable();
-    private static final Hashtable name2Class = new Hashtable();
+    private static final Hashtable<ObjectIdentifier, String> oid2Name = new Hashtable<ObjectIdentifier, String>();
+    private static final Hashtable<String, ObjectIdentifier> name2OID = new Hashtable<String, ObjectIdentifier>();
+    private static final Hashtable<String, String> name2Class = new Hashtable<String, String>();
 
     // Initialize recognized extensions from EXTENSIONS_{OIDS/CLASSES} files
     static {
@@ -174,9 +174,9 @@ public class OIDMap {
             }
         }
 
-        Enumeration names = props.propertyNames();
-        while (names.hasMoreElements()) {
-            String name = (String)names.nextElement();
+        Iterator<String> names = props.stringPropertyNames().iterator();
+        while (names.hasNext()) {
+            String name = names.next();
             String oidName = props.getProperty(name);
             ObjectIdentifier oid = new ObjectIdentifier(oidName);
 
@@ -201,9 +201,9 @@ public class OIDMap {
             }
         }
 
-        Enumeration names = props.propertyNames();
-        while (names.hasMoreElements()) {
-            String name = (String)names.nextElement();
+        Iterator<String> names = props.stringPropertyNames().iterator();
+        while (names.hasNext()) {
+            String name = names.next();
             String className = props.getProperty(name);
 
             name2Class.put(name, className);
@@ -265,12 +265,12 @@ public class OIDMap {
      * @param name the user friendly name.
      * @exception CertificateException if class cannot be instantiated.
      */
-    public static Class getClass(String name) throws CertificateException {
+    public static Class<?> getClass(String name) throws CertificateException {
         String className = (String)name2Class.get(name);
         if (className == null)
             return null;
         try {
-            Class extClass = Class.forName(className);
+            Class<?> extClass = Class.forName(className);
 	    return (extClass);
 	} catch (Exception e) {
 	  throw new CertificateException("Error instantiating class for "
@@ -284,7 +284,7 @@ public class OIDMap {
      * @param oid the name of the object identifier to be returned.
      * @exception CertificateException if class cannot be instatiated.
      */
-    public static Class getClass(ObjectIdentifier oid)
+    public static Class<?> getClass(ObjectIdentifier oid)
     throws CertificateException {
         String name = getName(oid);
         if (name == null)
@@ -293,7 +293,7 @@ public class OIDMap {
         if (className == null)
             return null;
         try {
-            Class extClass = Class.forName(className);
+            Class<?> extClass = Class.forName(className);
 	    return (extClass);
 	} catch (Exception e) {
 	    throw new CertificateException("Error instantiating class for "
diff --git a/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java b/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java
index 90dd5267dca72364159944447c675b34632cfedf..48f0b0428f8ba92a1ca9e8a8626800683a0c6e45 100644
--- a/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java
+++ b/pki/base/util/src/netscape/security/x509/PolicyMappingsExtension.java
@@ -65,7 +65,7 @@ implements CertAttrSet {
     public static final String MAP = "map";
 
     // Private data members
-    private Vector maps = null;
+    private Vector<CertificatePolicyMap> maps = null;
 
     // Encode this extension value
     private void encodeThis() throws IOException {
@@ -84,7 +84,7 @@ implements CertAttrSet {
      *
      * @param maps the Vector of CertificatePolicyMap.
      */
-    public PolicyMappingsExtension(Vector map) throws IOException {
+    public PolicyMappingsExtension(Vector<CertificatePolicyMap> map) throws IOException {
 		init(false, map);
     }
 
@@ -93,7 +93,7 @@ implements CertAttrSet {
      *
      * @param maps the Vector of CertificatePolicyMap.
      */
-    public PolicyMappingsExtension(boolean critical, Vector map) 
+    public PolicyMappingsExtension(boolean critical, Vector<CertificatePolicyMap> map) 
 	throws IOException {
 		init(critical, map);
 	}
@@ -101,7 +101,7 @@ implements CertAttrSet {
 	/**
 	 * init policy with criticality and map.
 	 */
-    private void init(boolean critical, Vector map) throws IOException {
+    private void init(boolean critical, Vector<CertificatePolicyMap> map) throws IOException {
         this.maps = map;
         this.extensionId = PKIXExtensions.PolicyMappings_Id;
         this.critical = critical;
@@ -114,7 +114,7 @@ implements CertAttrSet {
     public PolicyMappingsExtension() {
         extensionId = PKIXExtensions.PolicyMappings_Id;
         critical = false;
-        maps = new Vector(1,1);
+        maps = new Vector<CertificatePolicyMap>(1,1);
     }
 
     /**
@@ -140,7 +140,7 @@ implements CertAttrSet {
             throw new IOException("Invalid encoding for " +
                                   "PolicyMappingsExtension.");
         }
-        maps = new Vector(1, 1);
+        maps = new Vector<CertificatePolicyMap>(1, 1);
         while (val.data.available() != 0) {
             DerValue seq = val.data.getDerValue();
             CertificatePolicyMap map = new CertificatePolicyMap(seq);
@@ -189,14 +189,14 @@ implements CertAttrSet {
     /**
      * Set the attribute value.
      */
-    public void set(String name, Object obj) throws IOException {
+	public void set(String name, Object obj) throws IOException {
 	clearValue();
 	if (name.equalsIgnoreCase(MAP)) {
 	    if (!(obj instanceof Vector)) {
 	      throw new IOException("Attribute value should be of" +
                                     " type Vector.");
 	    }
-	    maps = (Vector)obj;
+	    maps = (Vector<CertificatePolicyMap>)obj;
 	} else {
 	  throw new IOException("Attribute name not recognized by " + 
 			"CertAttrSet:PolicyMappingsExtension.");
@@ -248,7 +248,7 @@ implements CertAttrSet {
     /**
      * Returns an enumeration of the mappings in the extension.
      */
-    public Enumeration getMappings() {
+    public Enumeration<CertificatePolicyMap> getMappings() {
 	if (maps == null) 
 		return null;
 	return maps.elements();
diff --git a/pki/base/util/src/netscape/security/x509/PolicyQualifiers.java b/pki/base/util/src/netscape/security/x509/PolicyQualifiers.java
index 5d04e0f986e3745083eb30d4c4fb74b15d44f4a2..fd2c161b2a24cfff038f79fe6a3715636891f634 100644
--- a/pki/base/util/src/netscape/security/x509/PolicyQualifiers.java
+++ b/pki/base/util/src/netscape/security/x509/PolicyQualifiers.java
@@ -37,7 +37,7 @@ public class PolicyQualifiers implements java.io.Serializable {
      *
      */
     private static final long serialVersionUID = 6932694408774694516L;
-    private Vector mInfo = new Vector();
+    private Vector<PolicyQualifierInfo> mInfo = new Vector<PolicyQualifierInfo>();
 
     /**
      * Create a PolicyQualifiers with the ObjectIdentifier.
@@ -73,7 +73,7 @@ public class PolicyQualifiers implements java.io.Serializable {
     }
  
     public PolicyQualifierInfo getInfoAt(int i) {
-        return (PolicyQualifierInfo)mInfo.elementAt(i);
+        return mInfo.elementAt(i);
     }
 
     /**
@@ -82,7 +82,7 @@ public class PolicyQualifiers implements java.io.Serializable {
     public String toString() {
         String s = "PolicyQualifiers: [";
         for (int i = 0; i < mInfo.size(); i++) {
-          PolicyQualifierInfo pq = (PolicyQualifierInfo)mInfo.elementAt(i);
+          PolicyQualifierInfo pq = mInfo.elementAt(i);
           s = s + pq.toString();
         }
         s = s + "]\n";
@@ -100,7 +100,7 @@ public class PolicyQualifiers implements java.io.Serializable {
         DerOutputStream tmp = new DerOutputStream();
 	
         for (int i = 0; i < mInfo.size(); i++) {
-          PolicyQualifierInfo pq = (PolicyQualifierInfo)mInfo.elementAt(i);
+          PolicyQualifierInfo pq = mInfo.elementAt(i);
           pq.encode(tmp);
 	}
 
diff --git a/pki/base/util/src/netscape/security/x509/RDN.java b/pki/base/util/src/netscape/security/x509/RDN.java
index 347fc4e1daf920fc0b14fbc0582698088c55834c..3ea5afbc7982785e91ee785930fab66c565bb70c 100644
--- a/pki/base/util/src/netscape/security/x509/RDN.java
+++ b/pki/base/util/src/netscape/security/x509/RDN.java
@@ -158,12 +158,12 @@ class RDN
     /**
      * convenience method.
      */
-    public RDN(Vector avaVector)
+    public RDN(Vector<AVA> avaVector)
     {
 	int size = avaVector.size();
 	assertion = new AVA[size];
 	for (int i = 0; i < size; i++) {
-	    assertion[i] = (AVA)avaVector.elementAt(i);
+	    assertion[i] = avaVector.elementAt(i);
 	}
     }
 
@@ -187,7 +187,7 @@ class RDN
 
     private AVA			assertion [];
 
-    private class AVAEnumerator implements Enumeration
+    private class AVAEnumerator implements Enumeration<AVA>
     {
 	private int index;
 
@@ -198,7 +198,7 @@ class RDN
 	    return (index < assertion.length);
 	}
 
-	public Object nextElement()
+	public AVA nextElement()
 	{
 	    AVA ava = null;
 	    if (index >= assertion.length)
@@ -262,7 +262,7 @@ class RDN
      * returns an enumeration of AVAs that make up this RDN.
      * @return an enumeration of AVAs that make up this RDN.
      */
-    public Enumeration getAVAs()
+    public Enumeration<AVA> getAVAs()
     {
 	return new AVAEnumerator();
     }
diff --git a/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java b/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java
index 99bd1665df66858634d4ba71eba2d4c82d9bffd0..5782f5303b479f4f3c42deb3e4c19768088dcb7d 100755
--- a/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java
+++ b/pki/base/util/src/netscape/security/x509/RevokedCertImpl.java
@@ -36,10 +36,11 @@ import netscape.security.util.DerValue;
 import netscape.security.util.ObjectIdentifier;
 
 /**
- * <p>Abstract class for a revoked certificate in a CRL.
- * This class is for each entry in the <code>revokedCertificates</code>,
- * so it deals with the inner <em>SEQUENCE</em>.
- * The ASN.1 definition for this is:
+ * <p>
+ * Abstract class for a revoked certificate in a CRL. This class is for each
+ * entry in the <code>revokedCertificates</code>, so it deals with the inner
+ * <em>SEQUENCE</em>. The ASN.1 definition for this is:
+ * 
  * <pre>
  * revokedCertificates    SEQUENCE OF SEQUENCE  {
  *     userCertificate    CertificateSerialNumber,
@@ -47,11 +48,11 @@ import netscape.security.util.ObjectIdentifier;
  *     crlEntryExtensions Extensions OPTIONAL
  *                        -- if present, must be v2
  * }  OPTIONAL
- *
+ * 
  * CertificateSerialNumber  ::=  INTEGER
- *
+ * 
  * Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension
- *
+ * 
  * Extension  ::=  SEQUENCE  {
  *     extnId        OBJECT IDENTIFIER,
  *     critical      BOOLEAN DEFAULT FALSE,
@@ -61,65 +62,70 @@ import netscape.security.util.ObjectIdentifier;
  *                   -- the extnId object identifier value
  * }
  * </pre>
- *
+ * 
  * @author Hemma Prafullchandra
  * @version 1.6 97/12/10
  */
 
-public class RevokedCertImpl extends RevokedCertificate
- implements Serializable{
+public class RevokedCertImpl extends RevokedCertificate implements Serializable{
 
     /**
      *
      */
-    private static final long serialVersionUID = -3449642360223397701L;
-    private SerialNumber serialNumber;
-    private Date revocationDate;
-    private CRLExtensions extensions = null;
-    private byte[] revokedCert;
-    private final static boolean isExplicit = false;
+        private static final long serialVersionUID = -3449642360223397701L;
+    
 
-    /**
-     * Default constructor.
-     */
-    public RevokedCertImpl() { }
+	private SerialNumber serialNumber;
+	private Date revocationDate;
+	private CRLExtensions extensions = null;
+	private byte[] revokedCert;
+	private final static boolean isExplicit = false;
 
-    /**
-     * Constructs a revoked certificate entry using the
-     * serial number and revocation date.
-     *
-     * @param num the serial number of the revoked certificate.
-     * @param date the Date on which revocation took place.
-     */
-    public RevokedCertImpl(BigInteger num, Date date) {
-        this.serialNumber = new SerialNumber(num);
-        this.revocationDate = date;
-    }
+	/**
+	 * Default constructor.
+	 */
+	public RevokedCertImpl() {
+	}
 
-    /**
-     * Constructs a revoked certificate entry using the
-     * serial number, revocation date and the entry
-     * extensions.
-     *
-     * @param num the serial number of the revoked certificate.
-     * @param date the Date on which revocation took place.
-     * @param crlEntryExts the extensions for this entry.
-     */
-    public RevokedCertImpl(BigInteger num, Date date,
-                           CRLExtensions crlEntryExts) {
-        this.serialNumber = new SerialNumber(num);
-        this.revocationDate = date;
-        this.extensions = crlEntryExts;
-    }
+	/**
+	 * Constructs a revoked certificate entry using the serial number and
+	 * revocation date.
+	 * 
+	 * @param num
+	 *            the serial number of the revoked certificate.
+	 * @param date
+	 *            the Date on which revocation took place.
+	 */
+	public RevokedCertImpl(BigInteger num, Date date) {
+		this.serialNumber = new SerialNumber(num);
+		this.revocationDate = date;
+	}
+
+	/**
+	 * Constructs a revoked certificate entry using the serial number,
+	 * revocation date and the entry extensions.
+	 * 
+	 * @param num
+	 *            the serial number of the revoked certificate.
+	 * @param date
+	 *            the Date on which revocation took place.
+	 * @param crlEntryExts
+	 *            the extensions for this entry.
+	 */
+	public RevokedCertImpl(BigInteger num, Date date, CRLExtensions crlEntryExts) {
+		this.serialNumber = new SerialNumber(num);
+		this.revocationDate = date;
+		this.extensions = crlEntryExts;
+	}
 
 	public byte[] getEncoded() throws CRLException {
 		// XXX NOT IMPLEMENTED
 		if (revokedCert == null) {
-    			DerOutputStream os = new DerOutputStream();
+			DerOutputStream os = new DerOutputStream();
 			try {
 				encode(os);
 			} catch (Exception e) {
-				//	revokedCert = null;
+				// revokedCert = null;
 			}
 			revokedCert = os.toByteArray();
 		}
@@ -131,316 +137,326 @@ public class RevokedCertImpl extends RevokedCertificate
 		return true;
 	}
 
-    /**
-     * Sets extensions for this impl.
-     *
-     * @param crlEntryExts CRLExtensions
-     */
-    public void setExtensions(CRLExtensions crlEntryExts) {
-        this.extensions = crlEntryExts;
-    }
+	/**
+	 * Sets extensions for this impl.
+	 * 
+	 * @param crlEntryExts
+	 *            CRLExtensions
+	 */
+	public void setExtensions(CRLExtensions crlEntryExts) {
+		this.extensions = crlEntryExts;
+	}
 
-    /**
-     * Unmarshals a revoked certificate from its encoded form.
-     *
-     * @param revokedCert the encoded bytes.
-     * @exception CRLException on parsing errors.
-     * @exception X509ExtensionException on extension handling errors.
-     */
-    public RevokedCertImpl(byte[] revokedCert)
-    throws CRLException, X509ExtensionException {
-        try {
-            DerValue derValue = new DerValue(revokedCert);
-            parse(derValue);
-        } catch (IOException e) {
-            throw new CRLException("Parsing error: " + e.toString());
-        }
-    }
+	/**
+	 * Unmarshals a revoked certificate from its encoded form.
+	 * 
+	 * @param revokedCert
+	 *            the encoded bytes.
+	 * @exception CRLException
+	 *                on parsing errors.
+	 * @exception X509ExtensionException
+	 *                on extension handling errors.
+	 */
+	public RevokedCertImpl(byte[] revokedCert) throws CRLException,
+			X509ExtensionException {
+		try {
+			DerValue derValue = new DerValue(revokedCert);
+			parse(derValue);
+		} catch (IOException e) {
+			throw new CRLException("Parsing error: " + e.toString());
+		}
+	}
 
-    /**
-     * Unmarshals a revoked certificate from its encoded form.
-     *
-     * @param derValue the DER value containing the revoked certificate.
-     * @exception CRLException on parsing errors.
-     * @exception X509ExtensionException on extension handling errors.
-     */
-    public RevokedCertImpl(DerValue derValue)
-    throws CRLException, X509ExtensionException {
-        parse(derValue);
-    }
+	/**
+	 * Unmarshals a revoked certificate from its encoded form.
+	 * 
+	 * @param derValue
+	 *            the DER value containing the revoked certificate.
+	 * @exception CRLException
+	 *                on parsing errors.
+	 * @exception X509ExtensionException
+	 *                on extension handling errors.
+	 */
+	public RevokedCertImpl(DerValue derValue) throws CRLException,
+			X509ExtensionException {
+		parse(derValue);
+	}
 
-    /**
-     * Returns true if this revoked certificate entry has
-     * extensions, otherwise false.
-     *
-     * @return true if this CRL entry has extensions, otherwise
-     * false.
-     */
-    public boolean hasExtensions() {
-        if (extensions == null)
-            return false;
-        else
-            return true;
-    }
+	/**
+	 * Returns true if this revoked certificate entry has extensions, otherwise
+	 * false.
+	 * 
+	 * @return true if this CRL entry has extensions, otherwise false.
+	 */
+	public boolean hasExtensions() {
+		if (extensions == null)
+			return false;
+		else
+			return true;
+	}
 
-    /**
-     * Decode a revoked certificate from an input stream.
-     *
-     * @param inStrm an input stream holding at least one revoked
-     * certificate
-     * @exception CRLException on parsing errors.
-     * @exception X509ExtensionException on extension handling errors.
-     */
-    public void decode(InputStream inStrm)
-    throws CRLException, X509ExtensionException {
-        try {
-            DerValue derValue = new DerValue(inStrm);
-            parse(derValue);
-        } catch (IOException e) {
-            throw new CRLException("Parsing error: " + e.toString());
-        }
-    }
+	/**
+	 * Decode a revoked certificate from an input stream.
+	 * 
+	 * @param inStrm
+	 *            an input stream holding at least one revoked certificate
+	 * @exception CRLException
+	 *                on parsing errors.
+	 * @exception X509ExtensionException
+	 *                on extension handling errors.
+	 */
+	public void decode(InputStream inStrm) throws CRLException,
+			X509ExtensionException {
+		try {
+			DerValue derValue = new DerValue(inStrm);
+			parse(derValue);
+		} catch (IOException e) {
+			throw new CRLException("Parsing error: " + e.toString());
+		}
+	}
 
-    /**
-     * Encodes the revoked certificate to an output stream.
-     *
-     * @param outStrm an output stream to which the encoded revoked
-     * certificate is written.
-     * @exception CRLException on encoding errors.
-     * @exception X509ExtensionException on extension handling errors.
-     */
-    public void encode(DerOutputStream outStrm)
-    throws CRLException, X509ExtensionException {
-        try {
-            if (revokedCert == null) {
-                DerOutputStream tmp = new DerOutputStream();
-                // sequence { serialNumber, revocationDate, extensions }
-                serialNumber.encode(tmp);
+	/**
+	 * Encodes the revoked certificate to an output stream.
+	 * 
+	 * @param outStrm
+	 *            an output stream to which the encoded revoked certificate is
+	 *            written.
+	 * @exception CRLException
+	 *                on encoding errors.
+	 * @exception X509ExtensionException
+	 *                on extension handling errors.
+	 */
+	public void encode(DerOutputStream outStrm) throws CRLException,
+			X509ExtensionException {
+		try {
+			if (revokedCert == null) {
+				DerOutputStream tmp = new DerOutputStream();
+				// sequence { serialNumber, revocationDate, extensions }
+				serialNumber.encode(tmp);
 
-                // from 2050 should encode GeneralizedTime
-                tmp.putUTCTime(revocationDate);
+				// from 2050 should encode GeneralizedTime
+				tmp.putUTCTime(revocationDate);
 
-                if (extensions != null)
-                    extensions.encode(tmp, isExplicit);
+				if (extensions != null)
+					extensions.encode(tmp, isExplicit);
 
-                DerOutputStream seq = new DerOutputStream();
-                seq.write(DerValue.tag_Sequence, tmp);
+				DerOutputStream seq = new DerOutputStream();
+				seq.write(DerValue.tag_Sequence, tmp);
 
-                revokedCert = seq.toByteArray();
-            }
-            outStrm.write(revokedCert);
-        } catch (IOException e) {
-             throw new CRLException("Encoding error: " + e.toString());
-        }
-    }
+				revokedCert = seq.toByteArray();
+			}
+			outStrm.write(revokedCert);
+		} catch (IOException e) {
+			throw new CRLException("Encoding error: " + e.toString());
+		}
+	}
 
-    /**
-     * Gets the serial number for this RevokedCertificate,
-     * the <em>userCertificate</em>.
-     *
-     * @return the serial number.
-     */
-    public BigInteger getSerialNumber() {
-        return ((BigInt)serialNumber.getNumber()).toBigInteger();
-    }
+	/**
+	 * Gets the serial number for this RevokedCertificate, the
+	 * <em>userCertificate</em>.
+	 * 
+	 * @return the serial number.
+	 */
+	public BigInteger getSerialNumber() {
+		return ((BigInt) serialNumber.getNumber()).toBigInteger();
+	}
 
-    /**
-     * Gets the revocation date for this RevokedCertificate,
-     * the <em>revocationDate</em>.
-     *
-     * @return the revocation date.
-     */
-    public Date getRevocationDate() {
-        return (new Date(revocationDate.getTime()));
-    }
+	/**
+	 * Gets the revocation date for this RevokedCertificate, the
+	 * <em>revocationDate</em>.
+	 * 
+	 * @return the revocation date.
+	 */
+	public Date getRevocationDate() {
+		return (new Date(revocationDate.getTime()));
+	}
 
-    /**
-     * Returns extensions for this impl.
-     *
-     * @return the CRLExtensions
-     */
-    public CRLExtensions getExtensions() {
-        return extensions;
-    }
+	/**
+	 * Returns extensions for this impl.
+	 * 
+	 * @return the CRLExtensions
+	 */
+	public CRLExtensions getExtensions() {
+		return extensions;
+	}
 
+	/**
+	 * Returns a printable string of this revoked certificate.
+	 * 
+	 * @return value of this revoked certificate in a printable form.
+	 */
+	public String toString() {
+		StringBuffer sb = new StringBuffer();
 
-    /**
-     * Returns a printable string of this revoked certificate.
-     *
-     * @return value of this revoked certificate in a printable form.
-     */
-    public String toString() {
-        StringBuffer sb = new StringBuffer();
+		sb.append(serialNumber.toString());
+		sb.append("  On: " + revocationDate.toString());
+		if (extensions != null) {
+			sb.append("\n");
+			for (int i = 0; i < extensions.size(); i++)
+				sb.append("Entry Extension[" + i + "]: "
+						+ ((Extension) (extensions.elementAt(i))).toString());
+		}
+		sb.append("\n");
+		return (sb.toString());
+	}
 
-        sb.append(serialNumber.toString());
-        sb.append("  On: " + revocationDate.toString());
-        if (extensions != null) {
-            sb.append("\n");
-            for (int i = 0; i < extensions.size(); i++)
-                sb.append("Entry Extension[" + i + "]: " +
-                     ((Extension)(extensions.elementAt(i))).toString());
-        }
-        sb.append("\n");
-        return (sb.toString());
-    }
+	/**
+	 * Gets a Set of the extension(s) marked CRITICAL in the RevokedCertificate
+	 * by OID strings.
+	 * 
+	 * @return a set of the extension oid strings in the Object that are marked
+	 *         critical.
+	 */
+	public Set<String> getCriticalExtensionOIDs() {
+		if (extensions == null)
+			return null;
+		Set<String> extSet = new TreeSet<String>();
+		Extension ex;
+		for (Enumeration<Extension> e = extensions.getElements(); e
+				.hasMoreElements();) {
+			ex = (Extension) e.nextElement();
+			if (ex.isCritical())
+				extSet.add(((ObjectIdentifier) ex.getExtensionId()).toString());
+		}
+		return extSet;
+	}
 
-    /**
-     * Gets a Set of the extension(s) marked CRITICAL in the
-     * RevokedCertificate by OID strings.
-     *
-     * @return a set of the extension oid strings in the
-     * Object that are marked critical.
-     */
-    public Set getCriticalExtensionOIDs() {
-        if (extensions == null)
-            return null;
-        Set extSet = new TreeSet();
-        Extension ex;
-            for (Enumeration e = extensions.getElements();
-                                          e.hasMoreElements();) {
-            ex = (Extension)e.nextElement();
-                if (ex.isCritical())
-                extSet.add(((ObjectIdentifier)ex.getExtensionId()).toString());
-            }
-        return extSet;
-    }
+	/**
+	 * Gets a Set of the extension(s) marked NON-CRITICAL in the
+	 * RevokedCertificate by OID strings.
+	 * 
+	 * @return a set of the extension oid strings in the Object that are marked
+	 *         critical.
+	 */
+	public Set<String> getNonCriticalExtensionOIDs() {
+		if (extensions == null)
+			return null;
+		Set<String> extSet = new TreeSet<String>();
+		Extension ex;
+		for (Enumeration<Extension> e = extensions.getElements(); e
+				.hasMoreElements();) {
+			ex = (Extension) e.nextElement();
+			if (!ex.isCritical())
+				extSet.add(ex.getExtensionId().toString());
+		}
+		return extSet;
+	}
 
-    /**
-     * Gets a Set of the extension(s) marked NON-CRITICAL in the
-     * RevokedCertificate by OID strings.
-     *
-     * @return a set of the extension oid strings in the
-     * Object that are marked critical.
-     */
-    public Set getNonCriticalExtensionOIDs() {
-        if (extensions == null)
-            return null;
-        Set extSet = new TreeSet();
-        Extension ex;
-            for (Enumeration e = extensions.getElements();
-                                          e.hasMoreElements();) {
-            ex = (Extension)e.nextElement();
-                if ( ! ex.isCritical())
-                extSet.add(((ObjectIdentifier)ex.getExtensionId()).toString());
-            }
-        return extSet;
-    }
+	/**
+	 * Gets the DER encoded OCTET string for the extension value (
+	 * <em>extnValue</em>) identified by the passed in oid String. The
+	 * <code>oid</code> string is represented by a set of positive whole number
+	 * separated by ".", that means,<br>
+	 * &lt;positive whole number&gt;.&lt;positive whole number&gt;.&lt;positive
+	 * whole number&gt;.&lt;...&gt;
+	 * 
+	 * @param oid
+	 *            the Object Identifier value for the extension.
+	 * @return the DER encoded octet string of the extension value.
+	 */
+	public byte[] getExtensionValue(String oid) {
+		if (extensions == null)
+			return null;
+		try {
+			String extAlias = OIDMap.getName(new ObjectIdentifier(oid));
+			Extension crlExt = null;
 
-    /**
-     * Gets the DER encoded OCTET string for the extension value
-     * (<em>extnValue</em>) identified by the passed in oid String.
-     * The <code>oid</code> string is
-     * represented by a set of positive whole number separated
-     * by ".", that means,<br>
-     * &lt;positive whole number&gt;.&lt;positive whole number&gt;.&lt;positive
-     * whole number&gt;.&lt;...&gt;
-     *
-     * @param oid the Object Identifier value for the extension.
-     * @return the DER encoded octet string of the extension value.
-     */
-    public byte[] getExtensionValue(String oid) {
-        if (extensions == null)
-            return null;
-            try {
-                String extAlias = OIDMap.getName(new ObjectIdentifier(oid));
-            Extension crlExt = null;
+			if (extAlias == null) { // may be unknown
+				ObjectIdentifier findOID = new ObjectIdentifier(oid);
+				Extension ex = null;
+				ObjectIdentifier inCertOID;
+				for (Enumeration<Extension> e = extensions.getElements(); e
+						.hasMoreElements();) {
+					ex = (Extension) e.nextElement();
+					inCertOID = ex.getExtensionId();
+					if (inCertOID.equals(findOID)) {
+						crlExt = ex;
+						break;
+					}
+				}
+			} else
+				crlExt = extensions.get(extAlias);
+			if (crlExt == null)
+				return null;
+			byte[] extData = crlExt.getExtensionValue();
+			if (extData == null)
+				return null;
 
-            if (extAlias == null) { // may be unknown
-                ObjectIdentifier findOID = new ObjectIdentifier(oid);
-                Extension ex = null;
-                ObjectIdentifier inCertOID;
-                for (Enumeration e=extensions.getElements();
-                                                 e.hasMoreElements();) {
-                    ex = (Extension)e.nextElement();
-                    inCertOID = ex.getExtensionId();
-                    if (inCertOID.equals(findOID)) {
-                        crlExt = ex;
-                        break;
-                    }
-                }
-            } else
-                crlExt = extensions.get(extAlias);
-                if (crlExt == null)
-                return null;
-                byte[] extData = crlExt.getExtensionValue();
-            if (extData == null)
-                return null;
+			DerOutputStream out = new DerOutputStream();
+			out.putOctetString(extData);
+			return out.toByteArray();
+		} catch (Exception e) {
+			return null;
+		}
+	}
 
-                    DerOutputStream out = new DerOutputStream();
-                    out.putOctetString(extData);
-            return out.toByteArray();
-        } catch (Exception e) {
-            return null;
-            }
-    }
+	private void parse(DerValue derVal) throws CRLException,
+			X509ExtensionException {
 
-    private void parse(DerValue derVal)
-    throws CRLException, X509ExtensionException  {
+		if (derVal.tag != DerValue.tag_Sequence) {
+			throw new CRLException("Invalid encoded RevokedCertificate, "
+					+ "starting sequence tag missing.");
+		}
+		if (derVal.data.available() == 0)
+			throw new CRLException("No data encoded for RevokedCertificates");
 
-       if (derVal.tag != DerValue.tag_Sequence) {
-            throw new CRLException("Invalid encoded RevokedCertificate, " +
-                                  "starting sequence tag missing.");
-        }
-        if (derVal.data.available() == 0)
-            throw new CRLException("No data encoded for RevokedCertificates");
+		// serial number
+		try {
+			DerInputStream in = derVal.toDerInputStream();
+			DerValue val = in.getDerValue();
+			this.serialNumber = new SerialNumber(val);
+		} catch (IOException e) {
+			throw new CRLException("Parsing Serial Number error: "
+					+ e.toString());
+		}
 
-        // serial number
-        try {
-            DerInputStream in = derVal.toDerInputStream();
-            DerValue val = in.getDerValue();
-            this.serialNumber = new SerialNumber(val);
-        } catch (IOException e) {
-            throw new CRLException("Parsing Serial Number error: "
-                                   + e.toString());
-        }
+		// revocationDate
+		try {
+			int nextByte = derVal.data.peekByte();
+			if ((byte) nextByte == DerValue.tag_UtcTime) {
+				this.revocationDate = derVal.data.getUTCTime();
+			} else if ((byte) nextByte == DerValue.tag_GeneralizedTime) {
+				this.revocationDate = derVal.data.getGeneralizedTime();
+			} else {
+				throw new CRLException(
+						"Invalid encoding for RevokedCertificates");
+			}
+		} catch (IOException e) {
+			throw new CRLException("Parsing Revocation Date error: "
+					+ e.toString());
+		}
 
-        // revocationDate
-        try {
-            int nextByte = derVal.data.peekByte();
-            if ((byte)nextByte == DerValue.tag_UtcTime) {
-                this.revocationDate = derVal.data.getUTCTime();
-            } else if ((byte)nextByte == DerValue.tag_GeneralizedTime) {
-                this.revocationDate = derVal.data.getGeneralizedTime();
-            } else {
-                throw new CRLException("Invalid encoding for RevokedCertificates");
-            }
-        } catch (IOException e) {
-            throw new CRLException("Parsing Revocation Date error: "
-                                   + e.toString());
-        }
+		if (derVal.data.available() == 0)
+			return; // no extensions
 
-        if (derVal.data.available() == 0)
-            return;  // no extensions
+		// crlEntryExtensions
+		try {
+			this.extensions = new CRLExtensions(derVal.toDerInputStream());
+		} catch (IOException e) {
+			throw new CRLException("Parsing CRL Entry Extensions error: "
+					+ e.toString());
+		}
+	}
 
-        // crlEntryExtensions
-        try {
-            this.extensions = new CRLExtensions(derVal.toDerInputStream());
-        } catch (IOException e) {
-            throw new CRLException("Parsing CRL Entry Extensions error: "
-                                   + e.toString());
-        }
-    }
+	/**
+	 * Serialization write ... X.509 certificates serialize as themselves, and
+	 * they're parsed when they get read back. (Actually they serialize as some
+	 * type data from the serialization subsystem, then the cert data.)
+	 */
+	private synchronized void writeObject(ObjectOutputStream stream)
+			throws CRLException, X509ExtensionException, IOException {
+		DerOutputStream dos = new DerOutputStream();
+		encode(dos);
+		dos.derEncode(stream);
+	}
 
-    /**
-     * Serialization write ... X.509 certificates serialize as
-     * themselves, and they're parsed when they get read back.
-     * (Actually they serialize as some type data from the
-     * serialization subsystem, then the cert data.)
-     */
-    private synchronized void writeObject(ObjectOutputStream stream)
-    throws CRLException, X509ExtensionException, IOException {
-        DerOutputStream dos = new DerOutputStream();
-        encode(dos);
-        dos.derEncode(stream);
-    }
-
-    /**
-     * Serialization read ... X.509 certificates serialize as
-     * themselves, and they're parsed when they get read back.
-     */
-    private synchronized void readObject(ObjectInputStream stream)
-    throws CRLException, X509ExtensionException, IOException {
-        decode(stream);
-    }
+	/**
+	 * Serialization read ... X.509 certificates serialize as themselves, and
+	 * they're parsed when they get read back.
+	 */
+	private synchronized void readObject(ObjectInputStream stream)
+			throws CRLException, X509ExtensionException, IOException {
+		decode(stream);
+	}
 
 }
diff --git a/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java b/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java
index da9170f3fa3c821ea63ba449bf4722987bb86537..e5ece1bed341c96f4893f42a86dc914e6f70dfc8 100644
--- a/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java
+++ b/pki/base/util/src/netscape/security/x509/SubjectDirAttributesExtension.java
@@ -77,7 +77,7 @@ implements CertAttrSet {
     public static final String NAME = "SubjectDirectoryAttributes";
 
     // Private data members
-    private Vector attrList = new Vector();
+    private Vector<Attribute> attrList = new Vector<Attribute>();
 
     // Encode this extension value
     private void encodeThis() throws IOException {
@@ -85,9 +85,9 @@ implements CertAttrSet {
         DerOutputStream tmp = new DerOutputStream();
 
 		//encoding the attributes
-		Enumeration attrs = attrList.elements();
+		Enumeration<Attribute> attrs = attrList.elements();
 		while (attrs.hasMoreElements()) {
-            Attribute attr = (Attribute) attrs.nextElement();
+            Attribute attr =  attrs.nextElement();
 		    attr.encode(tmp);
 		}
 
@@ -199,9 +199,9 @@ implements CertAttrSet {
     public String toString() {
         String s = super.toString() + "SubjectDirectoryAttributes:[\n";
 
-	Enumeration attrs = attrList.elements();
+	Enumeration<Attribute> attrs = attrList.elements();
 	while (attrs.hasMoreElements()) {
-	    Attribute attr = (Attribute) attrs.nextElement();
+	    Attribute attr = attrs.nextElement();
 	    s += attr.toString();
 	}
 
@@ -278,7 +278,7 @@ implements CertAttrSet {
     /**
      * Returns an enumeration of attributes in the extension.
      */
-    public Enumeration getAttributesList() {
+    public Enumeration<Attribute> getAttributesList() {
 	if (attrList == null) 
 		return null;
 	return attrList.elements();
diff --git a/pki/base/util/src/netscape/security/x509/X500Name.java b/pki/base/util/src/netscape/security/x509/X500Name.java
index c9980d3dc0a1dba04c0747b7fc4cf490440b234c..9efe6c0028b57f2328c273687c52478ca2a7f0e4 100644
--- a/pki/base/util/src/netscape/security/x509/X500Name.java
+++ b/pki/base/util/src/netscape/security/x509/X500Name.java
@@ -291,7 +291,7 @@ public class X500Name implements Principal, GeneralNameInterface {
      * convenience method.
      * @param rdns a vector of rdns.
      */
-    public X500Name (Vector rdnVector)
+    public X500Name (Vector<RDN> rdnVector)
     throws IOException
     {
 	int size = rdnVector.size();
@@ -550,7 +550,7 @@ public class X500Name implements Principal, GeneralNameInterface {
      * Returns an enumerator of RDNs in the X500Name.
      * @return enumeration of rdns in this X500Name.
      */
-    public Enumeration getRDNs()
+    public Enumeration<RDN> getRDNs()
     {
 	return new RDNEnumerator();
     }
@@ -672,7 +672,7 @@ public class X500Name implements Principal, GeneralNameInterface {
 	dn = ldapDNStrConverter.encodeDN(this);
     }
 
-    private class RDNEnumerator implements Enumeration
+    private class RDNEnumerator implements Enumeration<RDN>
     {
 	private int index;
 
@@ -683,7 +683,7 @@ public class X500Name implements Principal, GeneralNameInterface {
 	    return (index < names.length);
 	}
 
-	public Object nextElement()
+	public RDN nextElement()
 	{
 	    if (index >= names.length)
 		return null;
diff --git a/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java b/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java
index 60722924a62b7adb08eadb763e9e240d9c1260ae..48bb83021fe3734360ed822e0a70217474df9af6 100644
--- a/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java
+++ b/pki/base/util/src/netscape/security/x509/X500NameAttrMap.java
@@ -61,7 +61,7 @@ public class X500NameAttrMap
     public String getName(ObjectIdentifier oid)
     {
 	// XXX assert oid != null
-	return (String)oid2Name.get(oid);
+	return oid2Name.get(oid);
     }
 
     /**
@@ -74,7 +74,7 @@ public class X500NameAttrMap
     public ObjectIdentifier getOid(String name) 
     {
 	// XXX assert name != null
-	return (ObjectIdentifier)name2OID.get(name.toUpperCase());
+	return name2OID.get(name.toUpperCase());
     }
 
     /** 
@@ -86,7 +86,7 @@ public class X500NameAttrMap
      */
     public AVAValueConverter getValueConverter(String name)
     {
-	ObjectIdentifier oid = (ObjectIdentifier)
+	ObjectIdentifier oid = 
 				name2OID.get(name.toUpperCase());
 	if (oid == null) return null;
 	return (AVAValueConverter)oid2ValueConverter.get(oid);
@@ -109,7 +109,7 @@ public class X500NameAttrMap
      *
      * @return 	An Enumeration of all attribute names.
      */
-    public Enumeration getAllNames()
+    public Enumeration<String> getAllNames()
     {
 	return name2OID.keys();
     }
@@ -119,7 +119,7 @@ public class X500NameAttrMap
      *
      * @return 	An Enumeration of all OIDs in this map.
      */
-    public Enumeration getAllOIDs()
+    public Enumeration<ObjectIdentifier> getAllOIDs()
     {
 	return oid2Name.keys();
     }
@@ -132,10 +132,10 @@ public class X500NameAttrMap
      */
     public ObjectIdentifier getOid(ObjectIdentifier oid)
     {
-	String name = (String)oid2Name.get(oid);
+	String name = oid2Name.get(oid);
 	if (name == null)
 	    return null;
-	return (ObjectIdentifier)name2OID.get(name);
+	return name2OID.get(name);
     }
 
 
@@ -158,9 +158,9 @@ public class X500NameAttrMap
     {
 	// normalize name for case insensitive compare.
 	ObjectIdentifier theOid;
-        Class expValueConverter;
+        Class<? extends AVAValueConverter> expValueConverter;
 
-	theOid = (ObjectIdentifier)name2OID.get(name);
+	theOid = name2OID.get(name);
 	if (theOid != null) {
 	   expValueConverter = oid2ValueConverter.get(theOid).getClass();
 	   if (!theOid.equals(oid) || 
@@ -217,9 +217,9 @@ public class X500NameAttrMap
     // private variables
     //
 
-    Hashtable name2OID = new Hashtable();
-    Hashtable oid2Name = new Hashtable();
-    Hashtable oid2ValueConverter = new Hashtable();
+    Hashtable<String, ObjectIdentifier> name2OID = new Hashtable<String, ObjectIdentifier>();
+    Hashtable<ObjectIdentifier, String> oid2Name = new Hashtable<ObjectIdentifier, String>();
+    Hashtable<ObjectIdentifier, AVAValueConverter> oid2ValueConverter = new Hashtable<ObjectIdentifier, AVAValueConverter>();
 
     //
     // global defaults.
diff --git a/pki/base/util/src/netscape/security/x509/X509CertImpl.java b/pki/base/util/src/netscape/security/x509/X509CertImpl.java
index bb1b441a0d0e48aae978a6ebec28b6b2432cce99..c916a5d7630352df4dd544a447dd63cfac58d2d2 100755
--- a/pki/base/util/src/netscape/security/x509/X509CertImpl.java
+++ b/pki/base/util/src/netscape/security/x509/X509CertImpl.java
@@ -905,7 +905,7 @@ implements Serializable, DerEncoder {
      * @return a set of the extension oid strings in the
      * certificate that are marked critical.
      */
-    public Set getCriticalExtensionOIDs() {
+    public Set<String> getCriticalExtensionOIDs() {
         if (info == null)
             return null;
             try {
@@ -913,7 +913,7 @@ implements Serializable, DerEncoder {
                                              CertificateExtensions.NAME);
                 if (exts == null)
                 return null;
-            Set<String> extSet = new TreeSet();
+            Set<String> extSet = new TreeSet<String>();
             Extension ex;
                 for (Enumeration e = exts.getElements(); e.hasMoreElements(); ) {
                 ex = (Extension)e.nextElement();
@@ -933,7 +933,7 @@ implements Serializable, DerEncoder {
      * @return a set of the extension oid strings in the
      * certificate that are NOT marked critical.
      */
-    public Set getNonCriticalExtensionOIDs() {
+    public Set<String> getNonCriticalExtensionOIDs() {
         if (info == null)
             return null;
             try {
@@ -942,7 +942,7 @@ implements Serializable, DerEncoder {
                 if (exts == null)
                 return null;
 
-            Set extSet = new TreeSet();
+            Set<String> extSet = new TreeSet<String>();
             Extension ex;
                 for (Enumeration e = exts.getElements(); e.hasMoreElements(); ) {
                 ex = (Extension)e.nextElement();
diff --git a/pki/base/util/src/netscape/security/x509/X509Key.java b/pki/base/util/src/netscape/security/x509/X509Key.java
index 9d5f86a90e0960570f96261881c0bef25632e7d5..81422ea41f7a2a461bebb668c558ff203dfe8ab0 100644
--- a/pki/base/util/src/netscape/security/x509/X509Key.java
+++ b/pki/base/util/src/netscape/security/x509/X509Key.java
@@ -201,7 +201,7 @@ public class X509Key implements PublicKey {
 		throw new InstantiationException();
 	    }
 
-	    Class	keyClass = Class.forName(classname);
+	    Class<?>	keyClass = Class.forName(classname);
 	    Object	inst;
 	    X509Key	result;
 
-- 
1.7.7.3

