diff options
Diffstat (limited to 'pki/base/migrate/41ToTxt')
-rw-r--r-- | pki/base/migrate/41ToTxt/classes/CMS41LdifParser.class | bin | 9562 -> 0 bytes | |||
-rw-r--r-- | pki/base/migrate/41ToTxt/classes/Main.class | bin | 1615 -> 0 bytes | |||
-rwxr-xr-x | pki/base/migrate/41ToTxt/run.bat | 192 | ||||
-rwxr-xr-x | pki/base/migrate/41ToTxt/run.sh | 191 | ||||
-rw-r--r-- | pki/base/migrate/41ToTxt/src/Main.java | 464 | ||||
-rwxr-xr-x | pki/base/migrate/41ToTxt/src/compile.bat | 150 | ||||
-rwxr-xr-x | pki/base/migrate/41ToTxt/src/compile.sh | 150 |
7 files changed, 0 insertions, 1147 deletions
diff --git a/pki/base/migrate/41ToTxt/classes/CMS41LdifParser.class b/pki/base/migrate/41ToTxt/classes/CMS41LdifParser.class Binary files differdeleted file mode 100644 index b787984a2..000000000 --- a/pki/base/migrate/41ToTxt/classes/CMS41LdifParser.class +++ /dev/null diff --git a/pki/base/migrate/41ToTxt/classes/Main.class b/pki/base/migrate/41ToTxt/classes/Main.class Binary files differdeleted file mode 100644 index 87854eb4d..000000000 --- a/pki/base/migrate/41ToTxt/classes/Main.class +++ /dev/null diff --git a/pki/base/migrate/41ToTxt/run.bat b/pki/base/migrate/41ToTxt/run.bat deleted file mode 100755 index 35a5fda9f..000000000 --- a/pki/base/migrate/41ToTxt/run.bat +++ /dev/null @@ -1,192 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License along -REM with this program; if not, write to the Free Software Foundation, Inc., -REM 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script converts a pre-existing CMS 4.1 ldif data -REM file (e. g. - created via a utility such as db2ldif) -REM into a normalized CMS 4.1 ldif text file. -REM -REM This subsequent normalized CMS 4.1 ldif text file -REM can be migrated into CMS 6.0 or later utilizing -REM the corresponding TxtTo<Target CMS Version> script which -REM converts this normalized CMS 4.1 ldif text file into -REM a <Target CMS Version> ldif data file. -REM -REM This <Target CMS Version> ldif data file can then be -REM imported into the internal database of the desired CMS -REM server using a utility such as ldif2db. -REM - - -SETLOCAL - - -REM -REM SERVER_ROOT - fully qualified path of the location of the server -REM - -REM SET SERVER_ROOT=C:\cms41 - - -REM -REM INSTANCE - if the CMS instance directory is called 'cert-ca', -REM set the CMS instance to 'ca' -REM -REM NOTE: When a single SERVER_ROOT contains more than -REM one CMS instance, this script must be run multiple -REM times. To do this, there is only a need to change -REM the INSTANCE parameter. -REM - -REM SET INSTANCE=ca - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO USAGE -IF "%3" == "" GOTO CHECK_INPUT_FILE - - -:USAGE -ECHO. -ECHO Usage: "%0 input [errors] > output" -ECHO. -ECHO where: input - the specified %CMS% ldif data file, -ECHO errors - an optional errors file containing -ECHO skipped attributes, and -ECHO output - the normalized %CMS% ldif text file. -ECHO. -ECHO NOTE: If no redirection is provided to -ECHO 'output', then the normalized -ECHO %CMS% ldif text will merely -ECHO be echoed to stdout. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified "input" file exists -REM - -:CHECK_INPUT_FILE -IF EXIST %1 GOTO CHECK_ERRORS_FILE - - -ECHO ERROR: The specified input file, %1, does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM If an "errors" file is specified, then check that it does not already -REM exist. -REM - -:CHECK_ERRORS_FILE -IF "%2" == "" GOTO CHECK_ENVIRONMENT_VARIABLES -IF EXIST %2 GOTO ERRORS_FILE_ERROR -GOTO CHECK_ENVIRONMENT_VARIABLES - - -:ERRORS_FILE_ERROR -ECHO ERROR: The specified errors file, %2, already exists! -ECHO Please specify a different file! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%INSTANCE%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and INSTANCE -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_INSTANCE - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified INSTANCE exists -REM - -:CHECK_INSTANCE -IF EXIST %SERVER_ROOT%\cert-%INSTANCE% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified INSTANCE does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%SERVER_ROOT%\bin\base\jre\bin;%PATH% - - -REM -REM Convert the specified %CMS% ldif data file -REM into a normalized %CMS% ldif text file. -REM - -%SERVER_ROOT%\bin\cert\bin\jssjava.exe -classpath .\classes;%SERVER_ROOT%\cert-%INSTANCE%\classes;%SERVER_ROOT%\bin\cert\classes;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss.jar;%SERVER_ROOT%\bin\cert\jars\jssjdk12.jar;%SERVER_ROOT%\bin\base\jre\lib\rt.jar Main %1 %2 - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/pki/base/migrate/41ToTxt/run.sh b/pki/base/migrate/41ToTxt/run.sh deleted file mode 100755 index 390195ea1..000000000 --- a/pki/base/migrate/41ToTxt/run.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- - -##################################################################### -### ### -### This script converts a pre-existing CMS 4.1 ldif data ### -### file (e. g. - created via a utility such as db2ldif) ### -### into a normalized CMS 4.1 ldif text file. ### -### ### -### This subsequent normalized CMS 4.1 ldif text file ### -### can be migrated into CMS 6.0 or later utilizing ### -### the corresponding TxtTo<Target CMS Version> script which ### -### converts this normalized CMS 4.1 ldif text file into ### -### a <Target CMS Version> ldif data file. ### -### ### -### This <Target CMS Version> ldif data file can then be ### -### imported into the internal database of the desired CMS ### -### server using a utility such as ldif2db. ### -### ### -##################################################################### - - -### -### SERVER_ROOT - fully qualified path of the location of the server -### - -#SERVER_ROOT=/export/home/migrate/cms41 -#export SERVER_ROOT - - -### -### INSTANCE - if the CMS instance directory is called 'cert-ca', -### set the CMS instance to 'ca' -### -### NOTE: When a single SERVER_ROOT contains more than -### one CMS instance, this script must be run multiple -### times. To do this, there is only a need to change -### the INSTANCE parameter. -### - -#INSTANCE=ca -#export INSTANCE - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.1" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -## -## Perform a usage check for the appropriate number of arguments: -## - -if [ $# -lt 1 -o $# -gt 2 ] ; then - echo - echo "Usage: $0 input [errors] > output" - echo - echo " where: input - the specified ${CMS} ldif data file," - echo " errors - an optional errors file containing" - echo " skipped attributes, and" - echo " output - the normalized ${CMS} ldif text file." - echo - echo " NOTE: If no redirection is provided to" - echo " 'output', then the normalized" - echo " ${CMS} ldif text will merely" - echo " be echoed to stdout." - echo - exit 1 -fi - - -### -### Check that the specified "input" file exists and is a regular file. -### - -if [ ! -f $1 ] ; then - echo "ERROR: Either the specified 'input' file, '$1', does not exist, " - echo " or it is not a regular file!" - echo - exit 2 -fi - - -### -### Check that the specified "input" file exists and is not empty. -### - -if [ ! -s $1 ] ; then - echo "ERROR: The specified 'input' file, '$1', is empty!" - echo - exit 3 -fi - - -### -### If an "errors" file is specified, then check that it does not already -### exist. -### - -if [ $# -eq 2 ] ; then - if [ -f $2 ] ; then - echo "ERROR: The specified 'errors' file, '$2', already exists!" - echo " Please specify a different file!" - echo - exit 4 - fi -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${INSTANCE}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and INSTANCE " - echo " environment variables for this script!" - echo - exit 5 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 6 -fi - - -### -### Check that the specified INSTANCE exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}/cert-${INSTANCE}" ] ; then - echo "ERROR: Either the specified INSTANCE does not exist, " - echo " or it is not a directory!" - echo - exit 7 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform (SunOS) -### - -LD_LIBRARY_PATH=${SERVER_ROOT}/bin/base/jre/lib:${SERVER_ROOT}/bin/base/jre/lib/sparc/native_threads -export LD_LIBRARY_PATH - - -### -### Convert the specified ${CMS} ldif data file -### into a normalized ${CMS} ldif text file. -### - -${SERVER_ROOT}/bin/cert/bin/jssjava -classpath ./classes:${SERVER_ROOT}/cert-${INSTANCE}/classes:${SERVER_ROOT}/bin/cert/classes:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss.jar:${SERVER_ROOT}/bin/cert/jars/jssjdk12.jar:${SERVER_ROOT}/bin/base/jre/lib/rt.jar:${SERVER_ROOT}/bin/cert/jre/lib/i18n.jar Main $1 $2 - diff --git a/pki/base/migrate/41ToTxt/src/Main.java b/pki/base/migrate/41ToTxt/src/Main.java deleted file mode 100644 index 758d725a9..000000000 --- a/pki/base/migrate/41ToTxt/src/Main.java +++ /dev/null @@ -1,464 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -// -// "41ToTxt/src/Main.java" represents the initial CMS "ToTxt" migration file. -// -// Always comment any new code sections with a "CMS 4.1" header, and -// apply these changes forward to all other "*ToTxt/src/Main.java" files -// (including this comment header) so that these differences will only -// appear when this file is diffed against an earlier "*ToTxt" version. -// - -import java.io.*; -import java.math.*; -import java.util.*; -import sun.misc.*; -import com.netscape.jss.*; // CMS 4.1/4.2/4.2 (SP 2) -import netscape.security.util.*; - -public class Main -{ - public static void main(String args[]) - { - try { - // initialize CryptoManager in CMS 4.1/4.2/4.2 (SP 2) - CryptoManager.initialize("./secmod.db", "./key3.db", "./cert7.db"); - // load JSS provider in CMS 4.1/4.2/4.2 (SP 2) - java.security.Security.removeProvider("Netscape version 1.4"); - java.security.Security.removeProvider("SunRsaSign version 1.0"); -// java.security.Security.insertProviderAt( -// new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = - java.security.Security.getProviders(); - if (ps == null || ps.length <= 0) { - System.err.println("Java Security Provider NONE"); - } else { - for (int x = 0; x < ps.length; x++) { - System.err.println("Java Security Provider " + x + " class=" + ps[x]); - } - } - - // Parse the File - CMS41LdifParser parser = null; - if (args.length == 1) { - parser = new CMS41LdifParser(args[0]); - } else if (args.length == 2) { - parser = new CMS41LdifParser(args[0], args[1]); - } else { - throw new IOException("Invalid Parameters"); - } - parser.parse(); - } catch (Exception e) { - System.err.println("ERROR: " + e.toString()); - e.printStackTrace(); - } - } -} - -class CMS41LdifParser -{ - // constants - private static final String DN = - "dn:"; - // Directory Servers in CMS 4.1/4.2/4.2 (SP 2)/4.5 use "requestattributes" - private static final String REQUEST_ATTRIBUTES = - "requestattributes::"; - private static final String BEGIN = - "--- BEGIN ATTRIBUTES ---"; - private static final String END = - "--- END ATTRIBUTES ---"; - - // variables - private String mFilename = null; - private String mErrorFilename = null; - private PrintWriter mErrorPrintWriter = null; - - public CMS41LdifParser(String filename) - { - mFilename = filename; - } - - public CMS41LdifParser(String filename, String errorFilename) - { - mFilename = filename; - mErrorFilename = errorFilename; - } - - public void parse() throws Exception - { - if (mErrorFilename != null) { - mErrorPrintWriter = new PrintWriter(new FileOutputStream(mErrorFilename)); - } - BufferedReader reader = new BufferedReader( - new FileReader(mFilename)); - String line = null; - String dn = null; - StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith(DN)) { - dn = line; - } - if (line.startsWith(REQUEST_ATTRIBUTES)) { - requestAttributes = new StringBuffer(); - // System.out.println(line); - requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), - line.length()).trim()); - continue; - } - if (requestAttributes == null) { - System.out.println(line); - continue; - } - if (line.startsWith(" ")) { - // System.out.println(line); - requestAttributes.append(line.trim()); - } else { - parseAttributes(dn, requestAttributes); - requestAttributes = null; - System.out.println(line); - } - } - } - - public void parseAttributes(String dn, StringBuffer attrs) throws Exception - { - BASE64Decoder decoder = new BASE64Decoder(); - decodeHashtable(dn, decoder.decodeBuffer(attrs.toString())); - -// System.out.println(attrs); - } - - public Object decode(byte[] data) throws - ObjectStreamException, - IOException, - ClassNotFoundException - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - return is.readObject(); - } - - public void decodeHashtable(String dn, byte[] data) throws Exception - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(bis); - - System.out.println(BEGIN); - String key = null; - while (true) - { - key = (String)is.readObject(); - // end of table is marked with null - if (key == null) break; - try { - byte[] bytes = (byte[])is.readObject(); - Object obj = decode(bytes); - output(key, obj); - } catch (Exception e) { - if (mErrorPrintWriter != null) { - if (dn != null) { - mErrorPrintWriter.println(dn); - } - mErrorPrintWriter.println("Skipped " + key); - } - } - } - System.out.println(END); - } - - public void output(String key, Object obj) throws Exception - { - if (obj instanceof String) { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } else if (obj instanceof netscape.security.x509.CertificateX509Key) { - netscape.security.x509.CertificateX509Key o = - (netscape.security.x509.CertificateX509Key)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateSubjectName) { - netscape.security.x509.CertificateSubjectName o = - (netscape.security.x509.CertificateSubjectName)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateExtensions) { - netscape.security.x509.CertificateExtensions o = - (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertInfo) { - netscape.security.x509.X509CertInfo o = - (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl) { - netscape.security.x509.X509CertImpl o = - (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateChain) { - netscape.security.x509.CertificateChain o = - (netscape.security.x509.CertificateChain)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.X509CertImpl[]) { - netscape.security.x509.X509CertImpl o[] = - (netscape.security.x509.X509CertImpl[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.X509CertInfo[]) { - netscape.security.x509.X509CertInfo o[] = - (netscape.security.x509.X509CertInfo[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + - encoder.encodeBuffer(bos.toByteArray())); - } - } else if (obj instanceof netscape.security.x509.RevokedCertImpl[]) { - netscape.security.x509.RevokedCertImpl o[] = - (netscape.security.x509.RevokedCertImpl[])obj; - for (int i = 0; i < o.length; i++) { - DerOutputStream bos = - new DerOutputStream(); - o[i].encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(bos.toByteArray())); - } - } else if (obj instanceof java.security.cert.Certificate[]) { - java.security.cert.Certificate o[] = - (java.security.cert.Certificate[])obj; - for (int i = 0; i < o.length; i++) { - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + - encoder.encode(o[i].getEncoded())); - } - } else if (obj instanceof com.netscape.certsrv.base.ArgBlock) { - com.netscape.certsrv.base.ArgBlock o = - (com.netscape.certsrv.base.ArgBlock)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" +(String)o.get(k)); - } - } else if (obj instanceof com.netscape.certsrv.dbs.keydb.KeyRecord) { - com.netscape.certsrv.dbs.keydb.KeyRecord o = - (com.netscape.certsrv.dbs.keydb.KeyRecord)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob != null) { - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + encoder.encode((byte[])ob)); - - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } - } else if (obj instanceof com.netscape.certsrv.kra.ProofOfArchival) { - com.netscape.certsrv.kra.ProofOfArchival o = - (com.netscape.certsrv.kra.ProofOfArchival)obj; - DerOutputStream bos = - new DerOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - encoder.encode(bos.toByteArray())); - } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { - com.netscape.certsrv.request.AgentApprovals o = - (com.netscape.certsrv.request.AgentApprovals)obj; - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - com.netscape.certsrv.request.AgentApproval approval = (com.netscape.certsrv.request.AgentApproval)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - approval.getUserName() + ";" + approval.getDate().getTime()); - } - } else if (obj instanceof com.netscape.certsrv.authentication.AuthToken) { - com.netscape.certsrv.authentication.AuthToken o = - (com.netscape.certsrv.authentication.AuthToken)obj; - Enumeration e = o.getElements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - Object ob = o.get(k); - if (ob instanceof java.util.Date) { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ((java.util.Date)ob).getTime()); - } else if (ob instanceof java.math.BigInteger[]) { - // Bugzilla Bug #225031 (a.k.a. - Raidzilla Bug #58356) - java.math.BigInteger in[] = (java.math.BigInteger[])ob; - String numbers = ""; - for (int i = 0; i < in.length; i++) { - if (numbers.equals("")) { - numbers = in[i].toString(); - } else { - numbers = numbers + "," + in[i].toString(); - } - } - System.out.println(" " + - key + ":" + "com.netscape.certsrv.authentication.AuthToken" + "=" + - k + ":java.lang.String=" + numbers); - } else if (ob instanceof String[]) { - // Bugzilla Bug #224763 (a.k.a. - Raidzilla Bug #57949) - // Bugzilla Bug #252240 - String str[] = (String[])ob; - String v = ""; - if (str != null) { - for (int i = 0; i < str.length; i++) { - if (i != 0) { - v += ","; - } - v += str[i]; - } - } - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + "java.lang.String" + "=" + v); - } else { - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + ":" + ob.getClass().getName() + "=" + ob); - } - } - } else if (obj instanceof byte[]) { - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + ":byte[]="+ - encoder.encode((byte[])obj)); - } else if (obj instanceof Integer[]) { - Integer in[] = (Integer[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":Integer[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof BigInteger[]) { - // Bugzilla Bug #238779 - BigInteger in[] = (BigInteger[])obj; - for (int i = 0; i < in.length; i++) { - System.out.println(" " + key + ":java.math.BigInteger[" + in.length + "," + i + "]="+ in[i]); - } - } else if (obj instanceof String[]) { - // Bugzilla Bug #223360 (a.k.a - Raidzilla Bug #58086) - String str[] = (String[])obj; - for (int i = 0; i < str.length; i++) { - System.out.println(" " + key + ":java.lang.String[" + str.length + "," + i + "]="+ str[i]); - } - } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { - netscape.security.x509.CertificateAlgorithmId o = - (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof netscape.security.x509.CertificateValidity) { - netscape.security.x509.CertificateValidity o = - (netscape.security.x509.CertificateValidity)obj; - ByteArrayOutputStream bos = - new ByteArrayOutputStream(); - o.encode(bos); - BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ - encoder.encode(bos.toByteArray())); - } else if (obj instanceof java.util.Hashtable) { - // Bugzilla Bug #224800 (a.k.a - Raidzilla Bug #56953) - // - // Example: fingerprints:java.util.Hashtable= - // {SHA1=[B@52513a, MD5=[B@52c4d9, MD2=[B@799ff5} - // - java.util.Hashtable o = (java.util.Hashtable)obj; - BASE64Encoder encoder = new BASE64Encoder(); - Enumeration e = o.elements(); - while (e.hasMoreElements()) { - String k = (String)e.nextElement(); - System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + - k + "=" + encoder.encode((byte[])o.get(k))); - } - } else { - System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + - obj); - } - } -} - diff --git a/pki/base/migrate/41ToTxt/src/compile.bat b/pki/base/migrate/41ToTxt/src/compile.bat deleted file mode 100755 index fd92f3fb7..000000000 --- a/pki/base/migrate/41ToTxt/src/compile.bat +++ /dev/null @@ -1,150 +0,0 @@ -@ECHO OFF -REM --- BEGIN COPYRIGHT BLOCK --- -REM Copyright (C) 2007 Red Hat, Inc. -REM All rights reserved. -REM --- END COPYRIGHT BLOCK --- - -REM -REM This script creates the "41ToTxt/classes/Main.class" and -REM "41ToTxt/classes/CMS41LdifParser.class" which are -REM used to create a normalized CMS 4.1 ldif text file. -REM - - -SETLOCAL - - -REM -REM Set SERVER_ROOT - identify the CMS <server_root> used to compile 41ToTxt -REM - -REM SET SERVER_ROOT=C:\cms41 - - -REM -REM Set JDK_VERSION - specify the JDK version used by this version of CMS -REM -REM CMS 4.1 NOTE: "WINNT" - 1.1.6 -REM - -REM SET JDK_VERSION=CMS_4.1 - - -REM -REM Set JAVA_HOME - specify the complete path to the JDK -REM -REM example: \\bermuda.redhat.com\sbc mounted as Y: -REM - -REM SET JAVA_HOME=Y:\cms_jdk\WINNT\%JDK_VERSION% - - -REM -REM *** DON'T CHANGE ANYTHING BELOW THIS LINE *** -REM - - -REM -REM Script-defined constants -REM - -SET CMS="CMS 4.1" - - -REM -REM Perform a usage check for the appropriate number of arguments: -REM - -IF "%1" == "" GOTO CHECK_ENVIRONMENT_VARIABLES - - -:USAGE -ECHO. -ECHO Usage: "%0" -ECHO. -ECHO NOTE: No arguments are required to build the -ECHO normalized %CMS% ldif text classes. -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check presence of user-defined variables -REM - -:CHECK_ENVIRONMENT_VARIABLES -IF !%SERVER_ROOT%==! GOTO ENVIRONMENT_VARIABLES_ERROR -IF !%JAVA_HOME%==! GOTO ENVIRONMENT_VARIABLES_ERROR -GOTO CHECK_SERVER_ROOT - - -:ENVIRONMENT_VARIABLES_ERROR -ECHO ERROR: Please specify the SERVER_ROOT and JAVA_HOME -ECHO environment variables for this script! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified SERVER_ROOT exists -REM - -:CHECK_SERVER_ROOT -IF EXIST %SERVER_ROOT% GOTO CHECK_JAVA_HOME - - -ECHO ERROR: The specified SERVER_ROOT does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Check that the specified JAVA_HOME exists -REM - -:CHECK_JAVA_HOME -IF EXIST %JAVA_HOME% GOTO SET_LIBRARY_PATH - - -ECHO ERROR: The specified JAVA_HOME does not exist! -ECHO. -GOTO EXIT_PROCESS - - -REM -REM Setup the appropriate library path environment variable -REM based upon the platform (WINNT) -REM - -:SET_LIBRARY_PATH -SET PATH=%JAVA_HOME%\bin;%JAVA_HOME%\lib;%PATH% - - -REM -REM Set TARGET - identify the complete path to the new classes target directory -REM - -SET TARGET=..\classes - - -REM -REM Create the new classes target directory (if it does not already exist) -REM - -IF EXIST %TARGET% goto COMPILE_CLASSES -MKDIR %TARGET% - - -REM -REM Compile 41ToTxt - create "CMS41LdifParser.class" and "Main.class" -REM - -:COMPILE_CLASSES -%JAVA_HOME%\bin\javac.exe -d %TARGET% -classpath %JAVA_HOME%\lib\classes.zip;%SERVER_ROOT%\bin\cert\jars\certsrv.jar;%SERVER_ROOT%\bin\cert\jars\jss.jar;%SERVER_ROOT%\bin\cert\jars\jssjdk12.jar Main.java - - -:EXIT_PROCESS - - -ENDLOCAL - diff --git a/pki/base/migrate/41ToTxt/src/compile.sh b/pki/base/migrate/41ToTxt/src/compile.sh deleted file mode 100755 index 968190ff2..000000000 --- a/pki/base/migrate/41ToTxt/src/compile.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/sh -# --- BEGIN COPYRIGHT BLOCK --- -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -##################################################################### -### ### -### This script creates the "41ToTxt/classes/Main.class" and ### -### "41ToTxt/classes/CMS41LdifParser.class" which are ### -### used to create a normalized CMS 4.1 ldif text file. ### -### ### -##################################################################### - - -### -### Set SERVER_ROOT - identify the CMS <server_root> used to compile 41ToTxt -### - -#SERVER_ROOT=/export/home/migrate/cms41 -#export SERVER_ROOT - - -### -### Set JDK_PLATFORM - must be "SunOS" -### - -#JDK_PLATFORM=SunOS -#export JDK_PLATFORM - - -### -### Set JDK_VERSION - specify the JDK version used by this version of CMS -### -### CMS 4.1 NOTE: "SunOS" - 1.1.6 -### - -#JDK_VERSION=CMS_4.1 -#export JDK_VERSION - - -### -### Set JAVA_HOME - specify the complete path to the JDK -### - -#JAVA_HOME=/share/builds/components/cms_jdk/${JDK_PLATFORM}/${JDK_VERSION} -#export JAVA_HOME - - -############################################################################ -### ### -### *** DON'T CHANGE ANYTHING BELOW THIS LINE *** ### -### ### -############################################################################ - - -### -### Script-defined constants -### - -CMS="CMS 4.1" -export CMS - - -OS_NAME=`uname` -export OS_NAME - - -### -### Perform a usage check for the appropriate number of arguments: -### - -if [ $# -gt 0 ] ; then - echo - echo "Usage: $0" - echo - echo " NOTE: No arguments are required to build the" - echo " normalized ${CMS} ldif text classes." - echo - exit 1 -fi - - -### -### Check presence of user-defined variables -### - -if [ -z "${SERVER_ROOT}" -o -z "${JAVA_HOME}" ] ; then - echo "ERROR: Please specify the SERVER_ROOT and JAVA_HOME " - echo " environment variables for this script!" - echo - exit 2 -fi - - -### -### Check that the specified SERVER_ROOT exists and is a directory -### - -if [ ! -d "${SERVER_ROOT}" ] ; then - echo "ERROR: Either the specified SERVER_ROOT does not exist, " - echo " or it is not a directory!" - echo - exit 3 -fi - - -### -### Check that the specified JAVA_HOME exists and is a directory -### - -if [ ! -d "${JAVA_HOME}" ] ; then - echo "ERROR: Either the specified JAVA_HOME does not exist, " - echo " or it is not a directory!" - echo - exit 4 -fi - - -### -### Setup the appropriate library path environment variable -### based upon the platform (SunOS) -### - -LD_LIBRARY_PATH=${JAVA_HOME}/lib:${JAVA_HOME}/lib/sparc/native_threads -export LD_LIBRARY_PATH - - -### -### Set TARGET - identify the complete path to the new classes target directory -### - -TARGET=../classes -export TARGET - - -### -### Create the new classes target directory (if it does not already exist) -### - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - - -### -### Compile 41ToTxt - create "CMS41LdifParser.class" and "Main.class" -### - -${JAVA_HOME}/bin/javac -d ${TARGET} -classpath ${JAVA_HOME}/lib/classes.zip:${SERVER_ROOT}/bin/cert/jars/certsrv.jar:${SERVER_ROOT}/bin/cert/jars/jss.jar:${SERVER_ROOT}/bin/cert/jars/jssjdk12.jar Main.java - |