summaryrefslogtreecommitdiffstats
path: root/base/java-tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'base/java-tools/src')
-rw-r--r--base/java-tools/src/com/netscape/cmstools/AtoB.java7
-rw-r--r--base/java-tools/src/com/netscape/cmstools/CMCEnroll.java14
-rw-r--r--base/java-tools/src/com/netscape/cmstools/CMCRequest.java22
-rw-r--r--base/java-tools/src/com/netscape/cmstools/CMCResponse.java7
-rw-r--r--base/java-tools/src/com/netscape/cmstools/DRMTool.java95
-rw-r--r--base/java-tools/src/com/netscape/cmstools/PasswordCache.java22
-rw-r--r--base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java7
-rw-r--r--base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java7
8 files changed, 91 insertions, 90 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/AtoB.java b/base/java-tools/src/com/netscape/cmstools/AtoB.java
index e3059b0d1..51fb3cc17 100644
--- a/base/java-tools/src/com/netscape/cmstools/AtoB.java
+++ b/base/java-tools/src/com/netscape/cmstools/AtoB.java
@@ -61,7 +61,8 @@ public class AtoB {
BufferedReader inputBlob = null;
String asciiBASE64BlobChunk = "";
- String asciiBASE64Blob = "";
+ StringBuffer asciiBASE64Blob = new StringBuffer();
+
byte binaryBASE64Blob[] = null;
FileOutputStream outputBlob = null;
@@ -95,7 +96,7 @@ public class AtoB {
while ((asciiBASE64BlobChunk = inputBlob.readLine()) != null) {
if (!(asciiBASE64BlobChunk.startsWith(HEADER)) &&
!(asciiBASE64BlobChunk.startsWith(TRAILER))) {
- asciiBASE64Blob += asciiBASE64BlobChunk.trim();
+ asciiBASE64Blob.append(asciiBASE64BlobChunk.trim());
}
}
} catch (IOException e) {
@@ -115,7 +116,7 @@ public class AtoB {
// (5) Decode the ASCII BASE 64 blob enclosed in the
// String() object into a BINARY BASE 64 byte[] object
- binaryBASE64Blob = Utils.base64decode(asciiBASE64Blob);
+ binaryBASE64Blob = Utils.base64decode(asciiBASE64Blob.toString());
// (6) Finally, print the actual AtoB blob to the
// specified output file
diff --git a/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java b/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java
index ba8d71f3d..d13ed13f7 100644
--- a/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java
+++ b/base/java-tools/src/com/netscape/cmstools/CMCEnroll.java
@@ -394,13 +394,13 @@ public class CMCEnroll {
// headers beginning with HEADER and any trailers beginning
// with TRAILER
String asciiBASE64BlobChunk = "";
- String asciiBASE64Blob = "";
+ StringBuffer asciiBASE64Blob = new StringBuffer();
try {
while ((asciiBASE64BlobChunk = inputBlob.readLine()) != null) {
if (!(asciiBASE64BlobChunk.startsWith(HEADER)) &&
!(asciiBASE64BlobChunk.startsWith(TRAILER))) {
- asciiBASE64Blob += asciiBASE64BlobChunk.trim();
+ asciiBASE64Blob.append(asciiBASE64BlobChunk.trim());
}
}
} catch (IOException e) {
@@ -416,13 +416,13 @@ public class CMCEnroll {
"encoded error encountered in close():\n" + e);
}
- asciiBASE64Blob = getCMCBlob(signerCert, cm, nValue, asciiBASE64Blob);
+ String asciiBASE64Blob_str = getCMCBlob(signerCert, cm, nValue, asciiBASE64Blob.toString());
// (5) Decode the ASCII BASE 64 blob enclosed in the
// String() object into a BINARY BASE 64 byte[] object
@SuppressWarnings("unused")
byte binaryBASE64Blob[] =
- Utils.base64decode(asciiBASE64Blob); // check for errors
+ Utils.base64decode(asciiBASE64Blob_str); // check for errors
// (6) Finally, print the actual CMCEnroll blob to the
// specified output file
@@ -435,10 +435,10 @@ public class CMCEnroll {
}
System.out.println(HEADER);
- System.out.println(asciiBASE64Blob + TRAILER);
+ System.out.println(asciiBASE64Blob.toString() + TRAILER);
try {
- asciiBASE64Blob = HEADER + "\n" + asciiBASE64Blob + TRAILER;
- outputBlob.write(asciiBASE64Blob.getBytes());
+ asciiBASE64Blob_str = HEADER + "\n" + asciiBASE64Blob_str.toString() + TRAILER;
+ outputBlob.write(asciiBASE64Blob_str.getBytes());
} catch (IOException e) {
System.out.println("CMCEnroll: I/O error " +
"encountered during write():\n" +
diff --git a/base/java-tools/src/com/netscape/cmstools/CMCRequest.java b/base/java-tools/src/com/netscape/cmstools/CMCRequest.java
index e46b746aa..dc359a8b0 100644
--- a/base/java-tools/src/com/netscape/cmstools/CMCRequest.java
+++ b/base/java-tools/src/com/netscape/cmstools/CMCRequest.java
@@ -673,11 +673,12 @@ public class CMCRequest {
try {
byte bvalue[] = str.getBytes();
System.out.println("Data Return Control: ");
- String ss = " Value: ";
+ StringBuffer ss = new StringBuffer();
+ ss.append(" Value: ");
for (int m = 0; m < bvalue.length; m++) {
- ss = ss + bvalue[m] + " ";
+ ss.append(bvalue[m]).append(" ");
}
- System.out.println(ss);
+ System.out.println(ss.toString());
OCTET_STRING s = new OCTET_STRING(bvalue);
TaggedAttribute dataReturnControl = new TaggedAttribute(new
INTEGER(bpid++), OBJECT_IDENTIFIER.id_cmc_dataReturn, s);
@@ -756,11 +757,14 @@ public class CMCRequest {
}
byte bb[] = sn.getBytes();
System.out.println("SenderNonce control: ");
- String ss = " Value: ";
+
+ StringBuffer ss = new StringBuffer();
+
+ ss.append(" Value: ");
for (int m = 0; m < bb.length; m++) {
- ss = ss + bb[m] + " ";
+ ss.append(bb[m] + " ");
}
- System.out.println(ss);
+ System.out.println(ss.toString());
TaggedAttribute senderNonce = new TaggedAttribute(new
INTEGER(bpid++), OBJECT_IDENTIFIER.id_cmc_senderNonce,
new OCTET_STRING(sn.getBytes()));
@@ -1006,16 +1010,16 @@ public class CMCRequest {
// headers beginning with HEADER and any trailers beginning
// with TRAILER
String asciiBASE64BlobChunk = "";
- String asciiBASE64Blob = "";
+ StringBuffer asciiBASE64Blob = new StringBuffer();
try {
while ((asciiBASE64BlobChunk = inputBlob.readLine()) != null) {
if (!(asciiBASE64BlobChunk.startsWith(HEADER)) &&
!(asciiBASE64BlobChunk.startsWith(TRAILER))) {
- asciiBASE64Blob += asciiBASE64BlobChunk.trim();
+ asciiBASE64Blob.append(asciiBASE64BlobChunk.trim());
}
}
- requests[i] = asciiBASE64Blob;
+ requests[i] = asciiBASE64Blob.toString();
} catch (IOException e) {
System.out.println("CMCRequest: Unexpected BASE64 " +
"encoded error encountered in readLine():\n" +
diff --git a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
index 959f06f52..eae0b7303 100644
--- a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
+++ b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
@@ -73,7 +73,8 @@ public class CMCResponse {
org.mozilla.jss.pkix.cms.SignedData cmcFullResp =
(org.mozilla.jss.pkix.cms.SignedData) cii.getInterpretedContent();
- String content = "";
+ StringBuffer content = new StringBuffer();
+
if (cmcFullResp.hasCertificates()) {
SET certs = cmcFullResp.getCertificates();
int numCerts = certs.size();
@@ -82,12 +83,12 @@ public class CMCResponse {
Certificate cert = (Certificate) certs.elementAt(i);
X509CertImpl certImpl = new X509CertImpl(ASN1Util.encode(cert));
CertPrettyPrint print = new CertPrettyPrint(certImpl);
- content += print.toString(Locale.getDefault());
+ content.append(print.toString(Locale.getDefault()));
}
}
System.out.println("Certificates: ");
- System.out.println(content);
+ System.out.println(content.toString());
System.out.println("");
EncapsulatedContentInfo ci = cmcFullResp.getContentInfo();
OBJECT_IDENTIFIER id = ci.getContentType();
diff --git a/base/java-tools/src/com/netscape/cmstools/DRMTool.java b/base/java-tools/src/com/netscape/cmstools/DRMTool.java
index f67d735e6..164931d6c 100644
--- a/base/java-tools/src/com/netscape/cmstools/DRMTool.java
+++ b/base/java-tools/src/com/netscape/cmstools/DRMTool.java
@@ -1446,7 +1446,7 @@ public class DRMTool {
private static PublicKey getPublicKey() {
BufferedReader inputCert = null;
String encodedBASE64CertChunk = "";
- String encodedBASE64Cert = "";
+ StringBuffer encodedBASE64Cert = new StringBuffer();
byte decodedBASE64Cert[] = null;
X509CertImpl cert = null;
PublicKey key = null;
@@ -1481,7 +1481,7 @@ public class DRMTool {
while ((encodedBASE64CertChunk = inputCert.readLine()) != null) {
if (!(encodedBASE64CertChunk.startsWith(HEADER)) &&
!(encodedBASE64CertChunk.startsWith(TRAILER))) {
- encodedBASE64Cert += encodedBASE64CertChunk.trim();
+ encodedBASE64Cert.append(encodedBASE64CertChunk.trim());
}
}
} catch (IOException exWrapReadLineIO) {
@@ -1512,7 +1512,7 @@ public class DRMTool {
// Decode the ASCII BASE 64 certificate enclosed in the
// String() object into a BINARY BASE 64 byte[] object
decodedBASE64Cert = Utils.base64decode(
- encodedBASE64Cert);
+ encodedBASE64Cert.toString());
// Create an X509CertImpl() object from
// the BINARY BASE 64 byte[] object
@@ -1997,36 +1997,36 @@ public class DRMTool {
* suitable for an LDIF file
*/
private static String format_ldif_data(int length, String data) {
- String revised_data = "";
+ StringBuffer revised_data = new StringBuffer();
if (data.length() > length) {
// process first line
for (int i = 0; i < length; i++) {
- revised_data += data.charAt(i);
+ revised_data.append(data.charAt(i));
}
// terminate first line
- revised_data += '\n';
+ revised_data.append(System.getProperty("line.separator"));
// process remaining lines
int j = 0;
for (int i = length; i < data.length(); i++) {
if (j == 0) {
- revised_data += ' ';
+ revised_data.append(' ');
}
- revised_data += data.charAt(i);
+ revised_data.append(data.charAt(i));
j++;
if (j == 76) {
- revised_data += '\n';
+ revised_data.append(System.getProperty("line.separator"));
j = 0;
}
}
}
- return revised_data.replaceAll("\\s+$", "");
+ return revised_data.toString().replaceAll("\\s+$", "");
}
/*********************/
@@ -2778,8 +2778,9 @@ public class DRMTool {
* @return the composed output line
*/
private static String output_extdata_request_notes(String record_type,
- String line) {
- String input = null;
+ String line) {
+ StringBuffer input = new StringBuffer();
+
String data = null;
String unformatted_data = null;
String output = null;
@@ -2787,13 +2788,13 @@ public class DRMTool {
// extract the data
if (line.length() > DRM_LDIF_EXTDATA_REQUEST_NOTES.length()) {
- input = line.substring(
+ input.append(line.substring(
DRM_LDIF_EXTDATA_REQUEST_NOTES.length() + 1
- ).trim();
+ ).trim());
} else {
- input = line.substring(
+ input.append(line.substring(
DRM_LDIF_EXTDATA_REQUEST_NOTES.length()
- ).trim();
+ ).trim());
}
while ((line = ldif_record.next()) != null) {
@@ -2801,7 +2802,7 @@ public class DRMTool {
// Do NOT use "trim()";
// remove single leading space and
// trailing carriage returns and newlines ONLY!
- input += line.replaceFirst(" ", "").replace('\r', '\0').replace('\n', '\0');
+ input.append(line.replaceFirst(" ", "").replace('\r', '\0').replace('\n', '\0'));
} else {
next_line = line;
break;
@@ -2812,7 +2813,7 @@ public class DRMTool {
if (drmtoolCfg.get(DRMTOOL_CFG_ENROLLMENT_EXTDATA_REQUEST_NOTES)) {
// write out a revised 'extdata-requestnotes' line
if (mRewrapFlag && mAppendIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -2843,7 +2844,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRewrapFlag && mRemoveIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -2874,7 +2875,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRewrapFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -2898,7 +2899,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mAppendIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -2923,7 +2924,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRemoveIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -2957,7 +2958,7 @@ public class DRMTool {
+ SPACE
+ format_ldif_data(
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
- input)
+ input.toString())
+ TIC
+ NEWLINE
+ "--->"
@@ -2973,7 +2974,7 @@ public class DRMTool {
if (drmtoolCfg.get(DRMTOOL_CFG_RECOVERY_EXTDATA_REQUEST_NOTES)) {
// write out a revised 'extdata-requestnotes' line
if (mRewrapFlag && mAppendIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3004,7 +3005,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRewrapFlag && mRemoveIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3035,7 +3036,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRewrapFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3059,7 +3060,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mAppendIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3084,7 +3085,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRemoveIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3118,7 +3119,7 @@ public class DRMTool {
+ SPACE
+ format_ldif_data(
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
- input)
+ input.toString())
+ TIC
+ NEWLINE
+ "--->"
@@ -3134,7 +3135,7 @@ public class DRMTool {
if (drmtoolCfg.get(DRMTOOL_CFG_KEYGEN_EXTDATA_REQUEST_NOTES)) {
// write out a revised 'extdata-requestnotes' line
if (mRewrapFlag && mAppendIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3165,7 +3166,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRewrapFlag && mRemoveIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3196,7 +3197,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRewrapFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3220,7 +3221,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mAppendIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3245,7 +3246,7 @@ public class DRMTool {
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
unformatted_data);
} else if (mRemoveIdOffsetFlag) {
- data = input
+ data = input.toString()
+ SPACE
+ LEFT_BRACE
+ mDateOfModify
@@ -3279,7 +3280,7 @@ public class DRMTool {
+ SPACE
+ format_ldif_data(
EXTDATA_REQUEST_NOTES_FIRST_LINE_DATA_LENGTH,
- input)
+ input.toString())
+ TIC
+ NEWLINE
+ "--->"
@@ -3668,7 +3669,7 @@ public class DRMTool {
String line) {
byte source_wrappedKeyData[] = null;
byte target_wrappedKeyData[] = null;
- String data = null;
+ StringBuffer data = new StringBuffer();
String revised_data = null;
String unformatted_data = null;
String formatted_data = null;
@@ -3685,13 +3686,13 @@ public class DRMTool {
// these options have been selected
if (mRewrapFlag) {
// extract the data
- data = line.substring(
- DRM_LDIF_PRIVATE_KEY_DATA.length() + 1
- ).trim();
+ data.append(line.substring(
+ DRM_LDIF_PRIVATE_KEY_DATA.length() + 1
+ ).trim());
while ((line = ldif_record.next()) != null) {
if (line.startsWith(SPACE)) {
- data += line.trim();
+ data.append(line.trim());
} else {
break;
}
@@ -3701,7 +3702,7 @@ public class DRMTool {
// enclosed in the String() object
// into a BINARY BASE 64 byte[] object
source_wrappedKeyData =
- Utils.base64decode(data);
+ Utils.base64decode(data.toString());
// rewrap the source wrapped private key data
target_wrappedKeyData = rewrap_wrapped_key_data(
@@ -3734,7 +3735,7 @@ public class DRMTool {
log("Changed 'privateKeyData' from:"
+ NEWLINE
+ TIC
- + data
+ + data.toString()
+ TIC
+ NEWLINE
+ " to:"
@@ -3759,13 +3760,13 @@ public class DRMTool {
// these options have been selected
if (mRewrapFlag) {
// extract the data
- data = line.substring(
+ data.append(line.substring(
DRM_LDIF_PRIVATE_KEY_DATA.length() + 1
- ).trim();
+ ).trim());
while ((line = ldif_record.next()) != null) {
if (line.startsWith(SPACE)) {
- data += line.trim();
+ data.append(line.trim());
} else {
break;
}
@@ -3775,7 +3776,7 @@ public class DRMTool {
// enclosed in the String() object
// into a BINARY BASE 64 byte[] object
source_wrappedKeyData =
- Utils.base64decode(data);
+ Utils.base64decode(data.toString());
// rewrap the source wrapped private key data
target_wrappedKeyData = rewrap_wrapped_key_data(
@@ -3808,7 +3809,7 @@ public class DRMTool {
log("Changed 'privateKeyData' from:"
+ NEWLINE
+ TIC
- + data
+ + data.toString()
+ TIC
+ NEWLINE
+ " to:"
diff --git a/base/java-tools/src/com/netscape/cmstools/PasswordCache.java b/base/java-tools/src/com/netscape/cmstools/PasswordCache.java
index c9e36585e..1e123b17a 100644
--- a/base/java-tools/src/com/netscape/cmstools/PasswordCache.java
+++ b/base/java-tools/src/com/netscape/cmstools/PasswordCache.java
@@ -442,11 +442,11 @@ class PWsdrCache {
*/
public void addEntry(String tag, String pwd, Hashtable<String, String> tagPwds) throws IOException {
System.out.println("PWsdrCache: in addEntry");
- String stringToAdd = null;
+ StringBuffer stringToAdd = new StringBuffer();
String bufs = null;
if (tagPwds == null) {
- stringToAdd = tag + ":" + pwd + "\n";
+ stringToAdd.append(tag + ":" + pwd + System.getProperty("line.separator"));
} else {
Enumeration<String> enum1 = tagPwds.keys();
@@ -455,11 +455,7 @@ class PWsdrCache {
pwd = tagPwds.get(tag);
debug("password tag: " + tag + " stored in " + mPWcachedb);
- if (stringToAdd == null) {
- stringToAdd = tag + ":" + pwd + "\n";
- } else {
- stringToAdd += tag + ":" + pwd + "\n";
- }
+ stringToAdd.append(tag + ":" + pwd + System.getProperty("line.separator"));
}
}
@@ -480,7 +476,7 @@ class PWsdrCache {
bufs = hashtable2String(ht);
} else {
debug("adding new tag: " + tag);
- bufs = stringToAdd;
+ bufs = stringToAdd.toString();
}
// write update to cache
@@ -671,19 +667,15 @@ class PWsdrCache {
public String hashtable2String(Hashtable<String, String> ht) {
Enumeration<String> enum1 = ht.keys();
- String returnString = null;
+ StringBuffer returnString = new StringBuffer();
while (enum1.hasMoreElements()) {
String tag = enum1.nextElement();
String pwd = ht.get(tag);
+ returnString.append(tag + ":" + pwd + System.getProperty("line.separator"));
- if (returnString == null) {
- returnString = tag + ":" + pwd + "\n";
- } else {
- returnString += tag + ":" + pwd + "\n";
- }
}
- return returnString;
+ return returnString.toString();
}
public Hashtable<String, String> string2Hashtable(String cache) {
diff --git a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
index fdb988dd5..a713fb5a3 100644
--- a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
+++ b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
@@ -80,7 +80,8 @@ public class PrettyPrintCert {
BufferedReader inputCert = null;
String encodedBASE64CertChunk = "";
- String encodedBASE64Cert = "";
+ StringBuffer encodedBASE64Cert = new StringBuffer();
+
byte decodedBASE64Cert[] = null;
X509CertImpl cert = null;
Locale aLocale = null;
@@ -153,7 +154,7 @@ public class PrettyPrintCert {
while ((encodedBASE64CertChunk = inputCert.readLine()) != null) {
if (!(encodedBASE64CertChunk.startsWith(HEADER)) &&
!(encodedBASE64CertChunk.startsWith(TRAILER))) {
- encodedBASE64Cert += encodedBASE64CertChunk.trim();
+ encodedBASE64Cert.append(encodedBASE64CertChunk.trim());
}
}
} catch (IOException e) {
@@ -173,7 +174,7 @@ public class PrettyPrintCert {
// (5) Decode the ASCII BASE 64 certificate enclosed in the
// String() object into a BINARY BASE 64 byte[] object
- decodedBASE64Cert = Utils.base64decode(encodedBASE64Cert);
+ decodedBASE64Cert = Utils.base64decode(encodedBASE64Cert.toString());
// (6) Create an X509CertImpl() object from the BINARY BASE 64
// byte[] object
diff --git a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java
index 8bd4f9ed5..86bb82155 100644
--- a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java
+++ b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java
@@ -73,7 +73,8 @@ public class PrettyPrintCrl {
BufferedReader inputCrl = null;
String encodedBASE64CrlChunk = "";
- String encodedBASE64Crl = "";
+ StringBuffer encodedBASE64Crl = new StringBuffer(0);
+
byte decodedBASE64Crl[] = null;
X509CRLImpl crl = null;
Locale aLocale = null;
@@ -136,7 +137,7 @@ public class PrettyPrintCrl {
while ((encodedBASE64CrlChunk = inputCrl.readLine()) != null) {
if (!(encodedBASE64CrlChunk.startsWith(HEADER)) &&
!(encodedBASE64CrlChunk.startsWith(TRAILER))) {
- encodedBASE64Crl += encodedBASE64CrlChunk.trim();
+ encodedBASE64Crl.append(encodedBASE64CrlChunk.trim());
}
}
} catch (IOException e) {
@@ -156,7 +157,7 @@ public class PrettyPrintCrl {
// (5) Decode the ASCII BASE 64 CRL enclosed in the
// String() object into a BINARY BASE 64 byte[] object
- decodedBASE64Crl = Utils.base64decode(encodedBASE64Crl);
+ decodedBASE64Crl = Utils.base64decode(encodedBASE64Crl.toString());
// (6) Create an X509CRLImpl() object from the BINARY BASE 64
// byte[] object