diff options
author | mharmsen <mharmsen@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2009-06-10 16:15:54 +0000 |
---|---|---|
committer | mharmsen <mharmsen@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2009-06-10 16:15:54 +0000 |
commit | 896d10e3af28ac280684f802eb192c1ab25d8d02 (patch) | |
tree | b2270868e405f13f5bc26c164a3ef1b056b3e6d0 /pki/base/migrate/TxtTo72 | |
parent | 7433e539c115c641849ddb3c8cda507e3042a579 (diff) | |
download | pki-896d10e3af28ac280684f802eb192c1ab25d8d02.tar.gz pki-896d10e3af28ac280684f802eb192c1ab25d8d02.tar.xz pki-896d10e3af28ac280684f802eb192c1ab25d8d02.zip |
Bugzilla Bug #504420 - Make certain that Array Types are processed prior to
non-Array types . . .
Bugzilla Bug #483519 - rhcs73 migration tool misses iplanet case ERROR type -
iplanet.security.x509.X509CertImpl[1,0]
Bugzilla Bug #483373 - rhpki-migrate-7.3.0-9.el4 - TxtTo73/run.sh CLASSPATH
uses TxtTo72 classes path
Bugzilla Bug #451304 - 42ToTxt - Need to add i18n.jar to classpath for KRA
LDIF conversion
Bugzilla Bug #225031 - migrate/47ToTxt/run.sh against this sample ldif gives
AuthToken=certSerialNo:[Ljava.math.BigInteger.... error.
Bugzilla Bug #224972 - Migration / Upgrade script problems....
Bugzilla Bug #224801 - Upgrade script needs to change to drop those cert
request which were created by old jars (iplanet) files
Bugzilla Bug #224800 - txt to cms 62 upgrade script fails on some of the
request.
Bugzilla Bug #224763 - Migration scripts do not currently handle array of
strings properly
Bugzilla Bug #223360 - Upgrade tools does not currently handle some of the
parameters.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@573 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/migrate/TxtTo72')
-rw-r--r-- | pki/base/migrate/TxtTo72/classes/CMS72LdifParser.class | bin | 11509 -> 12186 bytes | |||
-rw-r--r-- | pki/base/migrate/TxtTo72/classes/DummyAuthManager.class | bin | 1187 -> 1187 bytes | |||
-rw-r--r-- | pki/base/migrate/TxtTo72/classes/Main.class | bin | 1513 -> 1513 bytes | |||
-rwxr-xr-x | pki/base/migrate/TxtTo72/run.bat | 10 | ||||
-rwxr-xr-x | pki/base/migrate/TxtTo72/run.sh | 3 | ||||
-rw-r--r-- | pki/base/migrate/TxtTo72/src/Main.java | 303 | ||||
-rwxr-xr-x | pki/base/migrate/TxtTo72/src/compile.sh | 6 |
7 files changed, 194 insertions, 128 deletions
diff --git a/pki/base/migrate/TxtTo72/classes/CMS72LdifParser.class b/pki/base/migrate/TxtTo72/classes/CMS72LdifParser.class Binary files differindex 51dd432cf..c3b8d5643 100644 --- a/pki/base/migrate/TxtTo72/classes/CMS72LdifParser.class +++ b/pki/base/migrate/TxtTo72/classes/CMS72LdifParser.class diff --git a/pki/base/migrate/TxtTo72/classes/DummyAuthManager.class b/pki/base/migrate/TxtTo72/classes/DummyAuthManager.class Binary files differindex 7fa7e3aa7..323081a39 100644 --- a/pki/base/migrate/TxtTo72/classes/DummyAuthManager.class +++ b/pki/base/migrate/TxtTo72/classes/DummyAuthManager.class diff --git a/pki/base/migrate/TxtTo72/classes/Main.class b/pki/base/migrate/TxtTo72/classes/Main.class Binary files differindex a059f8a6e..2512afa7d 100644 --- a/pki/base/migrate/TxtTo72/classes/Main.class +++ b/pki/base/migrate/TxtTo72/classes/Main.class diff --git a/pki/base/migrate/TxtTo72/run.bat b/pki/base/migrate/TxtTo72/run.bat index 1682bacbc..852158747 100755 --- a/pki/base/migrate/TxtTo72/run.bat +++ b/pki/base/migrate/TxtTo72/run.bat @@ -20,10 +20,10 @@ REM --- END COPYRIGHT BLOCK --- REM REM This script converts a normalized <Source CS Version> ldif REM text file (e. g. - created via a <Source CS Version>ToTxt -REM script) into a CS 7.1 ldif data file. +REM script) into a CS 7.2 ldif data file. REM -REM This CS 7.1 ldif data file can then be imported into the -REM internal database of the desired CS 7.1 server using a +REM This CS 7.2 ldif data file can then be imported into the +REM internal database of the desired CS 7.2 server using a REM utility such as ldif2db. REM @@ -35,7 +35,7 @@ REM REM SERVER_ROOT - fully qualified path of the location of the server REM -REM SET SERVER_ROOT=C:\cs71 +REM SET SERVER_ROOT=C:\cs72 REM @@ -60,7 +60,7 @@ REM REM Script-defined constants REM -SET CS="CS 7.1" +SET CS="CS 7.2" REM diff --git a/pki/base/migrate/TxtTo72/run.sh b/pki/base/migrate/TxtTo72/run.sh index ad64dbcdd..972686e3b 100755 --- a/pki/base/migrate/TxtTo72/run.sh +++ b/pki/base/migrate/TxtTo72/run.sh @@ -119,6 +119,9 @@ fi ### Setup the appropriate library path environment variable ### based upon the platform ### +### NOTE: As of SunOS JDK 1.4.0, the required "Unicode" classes +### have been moved from "i18n.jar" to "rt.jar". +### CLASSPATH=/usr/share/rhpki/migrate/TxtTo72/classes:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/share/java/rhpki/nsutil.jar:/usr/lib/java/dirsec/jss4.jar:${JRE_ROOT}/lib/rt.jar export CLASSPATH diff --git a/pki/base/migrate/TxtTo72/src/Main.java b/pki/base/migrate/TxtTo72/src/Main.java index 197e487e4..9b22cd84d 100644 --- a/pki/base/migrate/TxtTo72/src/Main.java +++ b/pki/base/migrate/TxtTo72/src/Main.java @@ -235,9 +235,22 @@ class CMS72LdifParser } return; } - String name = attr.substring(0, colon); - String type = attr.substring(colon+1, equal); - String value = attr.substring(equal+1); + String name = null; + String type = null; + String value = null; + try { + name = attr.substring(0, colon); + type = attr.substring(colon+1, equal); + value = attr.substring(equal+1); + } catch (Exception e) { + if (mErrorPrintWriter != null) { + if (dn != null) { + mErrorPrintWriter.println(dn); + } + mErrorPrintWriter.println("Skipped " + attr); + } + return; + } if (name.startsWith("serviceErrors")) { // #56953 - skip serviceErrors @@ -259,32 +272,34 @@ class CMS72LdifParser } return; } - if (type.startsWith("java.lang.String")) { - table.put(name, value); - } else if (type.startsWith("org.mozilla.jss.asn1.INTEGER")) { - // CMS 7.1 stores bodyPartId as INTEGER - // CS 72. fixed the problem by storing it as String - table.put(name, value); - } else if (type.startsWith("byte[]")) { - BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); - } else if (type.startsWith("java.lang.Integer")) { - table.put(name, new Integer(value)); - } else if (type.startsWith("java.math.BigInteger")) { - table.put(name, new java.math.BigInteger(value)); - } else if (type.startsWith("java.util.Locale")) { - // CMS 6.2: begin checking for new type - // "java.util.Locale" - table.put(name, Locale.getDefault()); - } else if (type.startsWith("java.util.Vector")) { - Vector obj = - (Vector)table.get(name); + + // To account for '47ToTxt' data files that have previously + // been generated, ALWAYS convert 'iplanet' to 'netscape'. + // + // Bugzilla Bug #224801 (a.k.a - Raidzilla Bug #56981) + // Bugzilla Bug #483519 + // + String translation = null; + if( type.startsWith( "iplanet" ) ) { + translation = "netscape" + + type.substring( 7 ); + type = translation; + } else if( type.startsWith( "com.iplanet" ) ) { + translation = "com.netscape" + + type.substring( 11 ); + type = translation; + } + + if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { + com.netscape.certsrv.request.AgentApprovals obj = + (com.netscape.certsrv.request.AgentApprovals)table.get(name); if (obj == null) { - obj = new Vector(); + obj = new com.netscape.certsrv.request.AgentApprovals(); table.put(name, obj); } - obj.addElement(value); - } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock") || type.startsWith("com.netscape.cmscore.base.ArgBlock")) { + obj.addApproval(value.substring(0,value.indexOf(';'))); + } else if (type.startsWith("com.netscape.certsrv.base.ArgBlock") + || type.startsWith("com.netscape.cmscore.base.ArgBlock")) { // CMS 6.1: created new "com.netscape.certsrv.base.IArgBlock" and // moved old "com.netscape.certsrv.base.ArgBlock" // to "com.netscape.cmscore.base.ArgBlock" @@ -300,14 +315,6 @@ class CMS72LdifParser String valuekey = value.substring(0, value.indexOf('=')); String valuevalue = value.substring(value.indexOf('=')+1); obj.set(valuekey, valuevalue); - } else if (type.startsWith("com.netscape.certsrv.request.AgentApprovals")) { - com.netscape.certsrv.request.AgentApprovals obj = - (com.netscape.certsrv.request.AgentApprovals)table.get(name); - if (obj == null) { - obj = new com.netscape.certsrv.request.AgentApprovals(); - table.put(name, obj); - } - obj.addApproval(value.substring(0,value.indexOf(';'))); } else if (type.startsWith("com.netscape.certsrv.authentication.AuthToken")) { com.netscape.certsrv.authentication.AuthToken obj = (com.netscape.certsrv.authentication.AuthToken)table.get(name); @@ -321,6 +328,15 @@ class CMS72LdifParser String valuetype = value.substring(value.indexOf(':')+1, value.indexOf('=')); String valuevalue = value.substring(value.indexOf('=')+1); if (valuetype.equals("java.lang.String")) { + // Processes 'java.math.BigInteger[]': + // + // Bugzilla Bug #225031 (a.k.a - Raidzilla Bug #58356) + // + // Processes 'java.lang.String[]': + // + // Bugzilla Bug #224763 (a.k.a - Raidzilla Bug #57949) + // Bugzilla Bug #252240 + // obj.set(valuekey, valuevalue); } else if (valuetype.equals("java.util.Date")) { obj.set(valuekey, new Date(Long.parseLong(valuevalue))); @@ -328,46 +344,36 @@ class CMS72LdifParser System.err.println("ERROR AuthToken type - " + attr); System.exit(0); } - } else if (type.startsWith("netscape.security.x509.X509CertInfo[") || type.startsWith("netscape.security.extensions.CertInfo[")) { - // CMS 6.2: begin checking for additional new type - // "netscape.security.extensions.CertInfo[" - // - // CMS 6.1: "netscape.security.x509.X509CertInfo" - // now always utilizes arrays such as - // "netscape.security.x509.X509CertInfo[" - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.x509.X509CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.x509.X509CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { - // - int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); - int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); + } else if (type.startsWith("java.math.BigInteger[")) { + // Bugzilla Bug #238779 + int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); + int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); + java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); + if (objs == null) { + objs = new java.math.BigInteger[size]; + table.put(name, objs); + } + objs[index] = new java.math.BigInteger(value); + } else if (type.startsWith("java.math.BigInteger")) { + table.put(name, new java.math.BigInteger(value)); + } else if (type.startsWith("byte[]")) { + BASE64Decoder decoder = new BASE64Decoder(); + table.put(name, decoder.decodeBuffer(value)); + } else if (type.startsWith("byte[")) { + // byte array BASE64Decoder decoder = new BASE64Decoder(); - if (objs == null) { - objs = new netscape.security.extensions.CertInfo[size]; - table.put(name, objs); - } - objs[index] = new netscape.security.extensions.CertInfo(); - objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); - } else if (type.equals("netscape.security.x509.CertificateX509Key")) { + table.put(name, decoder.decodeBuffer(value)); + } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateX509Key obj = - new netscape.security.x509.CertificateX509Key( - new ByteArrayInputStream(decoder.decodeBuffer(value))); + netscape.security.x509.CertificateAlgorithmId obj = + new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); table.put(name, obj); - } else if (type.equals("netscape.security.x509.X509CertInfo")) { + } else if (type.equals("netscape.security.x509.CertificateChain")) { BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertInfo obj = - new netscape.security.x509.X509CertInfo( - decoder.decodeBuffer(value)); + netscape.security.x509.CertificateChain obj = + new netscape.security.x509.CertificateChain(); + ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); + obj.decode(bis); table.put(name, obj); } else if (type.equals("netscape.security.x509.CertificateExtensions")) { BASE64Decoder decoder = new BASE64Decoder(); @@ -377,13 +383,6 @@ class CMS72LdifParser // CMS 6.2: revised method of decoding objects of type // "netscape.security.x509.CertificateExtensions" table.put(name, obj); - } else if (type.equals("netscape.security.x509.CertificateChain")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateChain obj = - new netscape.security.x509.CertificateChain(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); } else if (type.equals("netscape.security.x509.CertificateSubjectName")) { BASE64Decoder decoder = new BASE64Decoder(); netscape.security.x509.CertificateSubjectName obj = @@ -391,34 +390,58 @@ class CMS72LdifParser // CMS 6.2: revised method of decoding objects of type // "netscape.security.x509.CertificateSubjectName" table.put(name, obj); - } else if (type.equals("netscape.security.x509.X509CertImpl")) { + } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.X509CertImpl obj = - new netscape.security.x509.X509CertImpl( - decoder.decodeBuffer(value)); + netscape.security.x509.CertificateValidity obj = + new netscape.security.x509.CertificateValidity(); + ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); + obj.decode(bis); table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { - // + } else if (type.equals("netscape.security.x509.CertificateX509Key")) { + BASE64Decoder decoder = new BASE64Decoder(); + netscape.security.x509.CertificateX509Key obj = + new netscape.security.x509.CertificateX509Key( + new ByteArrayInputStream(decoder.decodeBuffer(value))); + table.put(name, obj); + } else if (type.startsWith("com.netscape.certsrv.cert.CertInfo")) { int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); + netscape.security.extensions.CertInfo objs[] = (netscape.security.extensions.CertInfo[])table.get(name); BASE64Decoder decoder = new BASE64Decoder(); if (objs == null) { - objs = new netscape.security.x509.X509CertImpl[size]; + objs = new netscape.security.extensions.CertInfo[size]; table.put(name, objs); } - objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { + objs[index] = new netscape.security.extensions.CertInfo(); + objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); + } else if (type.startsWith("java.util.Hashtable")) { + // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) + java.util.Hashtable obj = (java.util.Hashtable)table.get(name); + if (obj == null) { + obj = new java.util.Hashtable(); + table.put(name, obj); + } + BASE64Decoder decoder = new BASE64Decoder(); + String valuekey = value.substring(0, value.indexOf('=')); + String valuevalue = value.substring(value.indexOf('=')+1); + obj.put(valuekey, decoder.decodeBuffer(valuevalue)); + } else if (type.startsWith("Integer[")) { int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); - BASE64Decoder decoder = new BASE64Decoder(); + Integer objs[] = (Integer[])table.get(name); if (objs == null) { - objs = new netscape.security.x509.RevokedCertImpl[size]; - table.put(name, objs); + objs = new Integer[size]; + table.put(name, objs); } - objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); - } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { + objs[index] = new Integer(value); + } else if (type.startsWith("java.lang.Integer")) { + table.put(name, new Integer(value)); + } else if (type.startsWith("org.mozilla.jss.asn1.INTEGER")) { + // CMS 7.1 stores bodyPartId as INTEGER + // CS 72. fixed the problem by storing it as String + table.put(name, value); + } else if (type.startsWith("com.netscape.certsrv.dbs.keydb.KeyRecord") + || type.startsWith("com.netscape.cmscore.dbs.KeyRecord")) { com.netscape.cmscore.dbs.KeyRecord obj = (com.netscape.cmscore.dbs.KeyRecord)table.get(name); if (obj == null) { @@ -444,50 +467,91 @@ class CMS72LdifParser BASE64Decoder decoder = new BASE64Decoder(); obj.set(valuekey, decoder.decodeBuffer(valuevalue)); } else { - System.err.println("ERROR AuthToken type - " + attr); + System.err.println("ERROR KeyRecord type - " + attr); System.exit(0); } - } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { + } else if (type.startsWith("java.util.Locale")) { + // CMS 6.2: begin checking for new type + // "java.util.Locale" + table.put(name, Locale.getDefault()); + } else if (type.startsWith("com.netscape.certsrv.kra.ProofOfArchival") + || type.startsWith("com.netscape.cmscore.kra.ProofOfArchival")) { BASE64Decoder decoder = new BASE64Decoder(); ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); com.netscape.certsrv.kra.ProofOfArchival obj = buildPOA(decoder.decodeBuffer(value)); table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateAlgorithmId")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateAlgorithmId obj = - new netscape.security.x509.CertificateAlgorithmId(new ByteArrayInputStream(decoder.decodeBuffer(value))); - table.put(name, obj); - } else if (type.startsWith("netscape.security.x509.CertificateValidity")) { - BASE64Decoder decoder = new BASE64Decoder(); - netscape.security.x509.CertificateValidity obj = - new netscape.security.x509.CertificateValidity(); - ByteArrayInputStream bis = new ByteArrayInputStream(decoder.decodeBuffer(value)); - obj.decode(bis); - table.put(name, obj); - } else if (type.startsWith("Integer[")) { + } else if (type.startsWith("netscape.security.x509.RevokedCertImpl")) { int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - Integer objs[] = (Integer[])table.get(name); + netscape.security.x509.RevokedCertImpl objs[] = (netscape.security.x509.RevokedCertImpl[])table.get(name); + BASE64Decoder decoder = new BASE64Decoder(); if (objs == null) { - objs = new Integer[size]; - table.put(name, objs); + objs = new netscape.security.x509.RevokedCertImpl[size]; + table.put(name, objs); } - objs[index] = new Integer(value); - } else if (type.startsWith("java.math.BigInteger[")) { + objs[index] = new netscape.security.x509.RevokedCertImpl(decoder.decodeBuffer(value)); + } else if (type.startsWith("java.lang.String[")) { + // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); - java.math.BigInteger objs[] = (java.math.BigInteger[])table.get(name); + java.lang.String objs[] = (java.lang.String[])table.get(name); if (objs == null) { - objs = new java.math.BigInteger[size]; + objs = new java.lang.String[size]; table.put(name, objs); } - objs[index] = new java.math.BigInteger(value); - } else if (type.startsWith("byte[")) { - // byte array + objs[index] = new java.lang.String(value); + } else if (type.startsWith("java.lang.String")) { + table.put(name, value); + } else if (type.startsWith("java.util.Vector")) { + Vector obj = + (Vector)table.get(name); + if (obj == null) { + obj = new Vector(); + table.put(name, obj); + } + obj.addElement(value); + } else if (type.startsWith("netscape.security.x509.X509CertImpl[")) { + int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); + int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); + netscape.security.x509.X509CertImpl objs[] = (netscape.security.x509.X509CertImpl[])table.get(name); BASE64Decoder decoder = new BASE64Decoder(); - table.put(name, decoder.decodeBuffer(value)); + if (objs == null) { + objs = new netscape.security.x509.X509CertImpl[size]; + table.put(name, objs); + } + objs[index] = new netscape.security.x509.X509CertImpl(decoder.decodeBuffer(value)); + } else if (type.equals("netscape.security.x509.X509CertImpl")) { + BASE64Decoder decoder = new BASE64Decoder(); + netscape.security.x509.X509CertImpl obj = + new netscape.security.x509.X509CertImpl( + decoder.decodeBuffer(value)); + table.put(name, obj); + } else if (type.startsWith("netscape.security.x509.X509CertInfo[") + || type.startsWith("netscape.security.extensions.CertInfo[")) { + // CMS 6.2: begin checking for additional new type + // "netscape.security.extensions.CertInfo[" + // + // CMS 6.1: "netscape.security.x509.X509CertInfo" + // now always utilizes arrays such as + // "netscape.security.x509.X509CertInfo[" + int size = Integer.parseInt(type.substring(type.indexOf('[')+ 1, type.indexOf(','))); + int index = Integer.parseInt(type.substring(type.indexOf(',')+1, type.indexOf(']'))); + netscape.security.x509.X509CertInfo objs[] = (netscape.security.x509.X509CertInfo[])table.get(name); + BASE64Decoder decoder = new BASE64Decoder(); + if (objs == null) { + objs = new netscape.security.x509.X509CertInfo[size]; + table.put(name, objs); + } + objs[index] = new netscape.security.x509.X509CertInfo(); + objs[index].decode(new ByteArrayInputStream(decoder.decodeBuffer(value))); + } else if (type.equals("netscape.security.x509.X509CertInfo")) { + BASE64Decoder decoder = new BASE64Decoder(); + netscape.security.x509.X509CertInfo obj = + new netscape.security.x509.X509CertInfo( + decoder.decodeBuffer(value)); + table.put(name, obj); } else if( type.endsWith( "Exception" ) ) { Class[] argClass = { String.class }; // the argument's class Object[] argValue = { value }; // the argument's value @@ -496,7 +560,6 @@ class CMS72LdifParser Constructor ctr = x.getConstructor( argClass ); Exception e = ( Exception ) ctr.newInstance( argValue ); } else { - // System.err.println("ERROR type - " + type + " - "+ attr); System.exit(0); } diff --git a/pki/base/migrate/TxtTo72/src/compile.sh b/pki/base/migrate/TxtTo72/src/compile.sh index d08c7f47e..ec0b466ba 100755 --- a/pki/base/migrate/TxtTo72/src/compile.sh +++ b/pki/base/migrate/TxtTo72/src/compile.sh @@ -110,7 +110,7 @@ elif [ ${OS_NAME} = "Linux" ] ; then LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/i386/native_threads export LD_LIBRARY_PATH else # SunOS - LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads + LD_LIBRARY_PATH=/usr/lib:/usr/lib/dirsec:${JAVA_HOME}/lib:${JAVA_HOME}/lib/native_threads export LD_LIBRARY_PATH fi @@ -133,9 +133,9 @@ fi ### -### Compile TxtTo70 - create "CMS72LdifParser.class", "DummyAuthManager.class", +### Compile TxtTo72 - create "CMS72LdifParser.class", "DummyAuthManager.class", ### and "Main.class" ### -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:/usr/share/java/rhpki/nsutil.jar:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/lib/java/dirsec/jss4.jar Main.java +${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/jre/lib/rt.jar:/usr/share/java/rhpki/nsutil.jar:/usr/share/java/rhpki/certsrv.jar:/usr/share/java/rhpki/cmscore.jar:/usr/lib/java/rhpki/ca/ca.jar:/usr/lib/java/rhpki/tks/tks.jar:/usr/lib/java/rhpki/ocsp/ocsp.jar:/usr/lib/java/rhpki/kra/kra.jar:/usr/lib/java/dirsec/jss4.jar Main.java |