diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-04-05 14:49:11 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-04-09 10:03:25 -0500 |
commit | 7c7b9d023cd466c1771068badc020dab36beb553 (patch) | |
tree | 178877eb83e25336be7577953945fbdb0b9e1a15 /base/migrate/71ToTxt | |
parent | da1e6e2f49f66fd46c8039ff1aa4386309fba8f4 (diff) | |
download | pki-7c7b9d023cd466c1771068badc020dab36beb553.tar.gz pki-7c7b9d023cd466c1771068badc020dab36beb553.tar.xz pki-7c7b9d023cd466c1771068badc020dab36beb553.zip |
Removed whitespaces from Java code.
Whitespaces in Java code have been removed with the following command:
find . -not -path .git -name *.java -exec sed -i 's/[[:blank:]]\+$//' {} \;
Ticket #134
Diffstat (limited to 'base/migrate/71ToTxt')
-rw-r--r-- | base/migrate/71ToTxt/src/Main.java | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/base/migrate/71ToTxt/src/Main.java b/base/migrate/71ToTxt/src/Main.java index f7f3a5b95..796653370 100644 --- a/base/migrate/71ToTxt/src/Main.java +++ b/base/migrate/71ToTxt/src/Main.java @@ -38,7 +38,7 @@ import netscape.security.util.*; public class Main { - public static void main(String args[]) + public static void main(String args[]) { try { // initialize CryptoManager in CMS 4.5 and later @@ -48,15 +48,15 @@ public class Main // The following call to "java.security.Security.insertProviderAt()" // is no longer commented out in CMS 4.5 and later java.security.Security.insertProviderAt( - new netscape.security.provider.CMS(), 0); - java.security.Provider ps[] = + 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]); - } + 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 @@ -79,14 +79,14 @@ public class Main class CMS71LdifParser { // constants - private static final String DN = + private static final String DN = "dn:"; // Directory Servers in CMS 4.7 and later use "requestAttributes" - private static final String REQUEST_ATTRIBUTES = + private static final String REQUEST_ATTRIBUTES = "requestAttributes::"; - private static final String BEGIN = + private static final String BEGIN = "--- BEGIN ATTRIBUTES ---"; - private static final String END = + private static final String END = "--- END ATTRIBUTES ---"; // variables @@ -106,16 +106,16 @@ class CMS71LdifParser } 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; + new FileReader(mFilename)); + String line = null; + String dn = null; StringBuffer requestAttributes = null; - while ((line = reader.readLine()) != null) { + while ((line = reader.readLine()) != null) { if (line.startsWith(DN)) { dn = line; } @@ -123,7 +123,7 @@ class CMS71LdifParser requestAttributes = new StringBuffer(); // System.out.println(line); requestAttributes.append( - line.substring(REQUEST_ATTRIBUTES.length(), + line.substring(REQUEST_ATTRIBUTES.length(), line.length()).trim()); continue; } @@ -139,41 +139,41 @@ class CMS71LdifParser 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 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); + 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; + 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(); + byte[] bytes = (byte[])is.readObject(); Object obj = decode(bytes); output(key, obj); } catch (Exception e) { @@ -184,7 +184,7 @@ class CMS71LdifParser mErrorPrintWriter.println("Skipped " + key); } } - } + } System.out.println(END); } @@ -192,22 +192,22 @@ class CMS71LdifParser { if (obj instanceof String) { System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + + 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 = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + + 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 = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); @@ -217,7 +217,7 @@ class CMS71LdifParser } else if (obj instanceof netscape.security.x509.CertificateExtensions) { netscape.security.x509.CertificateExtensions o = (netscape.security.x509.CertificateExtensions)obj; - ByteArrayOutputStream bos = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); @@ -227,7 +227,7 @@ class CMS71LdifParser } else if (obj instanceof netscape.security.x509.X509CertInfo) { netscape.security.x509.X509CertInfo o = (netscape.security.x509.X509CertInfo)obj; - ByteArrayOutputStream bos = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); @@ -237,68 +237,68 @@ class CMS71LdifParser } else if (obj instanceof netscape.security.x509.X509CertImpl) { netscape.security.x509.X509CertImpl o = (netscape.security.x509.X509CertImpl)obj; - ByteArrayOutputStream bos = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + + 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 = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + + 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 = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o[i].encode(bos); BASE64Encoder encoder = new BASE64Encoder(); System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + + 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 = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o[i].encode(bos); BASE64Encoder encoder = new BASE64Encoder(); System.out.println(" " + - key + ":" + o[i].getClass().getName() + "["+o.length + "," + i+"]"+"=" + + 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 = + DerOutputStream bos = new DerOutputStream(); o[i].encode(bos); BASE64Encoder encoder = new BASE64Encoder(); System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + + 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 = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); BASE64Encoder encoder = new BASE64Encoder(); System.out.println(" " + - key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + + key + ":" + o[i].getClass().getName() +"["+o.length+","+i+"]" + "=" + encoder.encode(o[i].getEncoded())); } } else if (obj instanceof com.netscape.cmscore.base.ArgBlock) { @@ -346,12 +346,12 @@ class CMS71LdifParser // to "com.netscape.cmscore.kra.ProofOfArchival" com.netscape.cmscore.kra.ProofOfArchival o = (com.netscape.cmscore.kra.ProofOfArchival)obj; - DerOutputStream bos = + DerOutputStream bos = new DerOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); System.out.println(" " + - key + ":" + o.getClass().getName() + "=" + + key + ":" + o.getClass().getName() + "=" + encoder.encode(bos.toByteArray())); } else if (obj instanceof com.netscape.certsrv.request.AgentApprovals) { com.netscape.certsrv.request.AgentApprovals o = @@ -434,22 +434,22 @@ class CMS71LdifParser } else if (obj instanceof netscape.security.x509.CertificateAlgorithmId) { netscape.security.x509.CertificateAlgorithmId o = (netscape.security.x509.CertificateAlgorithmId)obj; - ByteArrayOutputStream bos = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateAlgorithmId="+ + 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 = + ByteArrayOutputStream bos = new ByteArrayOutputStream(); o.encode(bos); BASE64Encoder encoder = new BASE64Encoder(); - System.out.println(" " + key + - ":netscape.security.x509.CertificateValidity="+ + System.out.println(" " + key + + ":netscape.security.x509.CertificateValidity="+ encoder.encode(bos.toByteArray())); } else if (obj instanceof byte[]) { // Since 6.1's profile framework, @@ -475,7 +475,7 @@ class CMS71LdifParser } } else { System.out.println(" " + - key + ":" + obj.getClass().getName() + "=" + + key + ":" + obj.getClass().getName() + "=" + obj); } } |