[Webfunds-commits] java/webfunds/sox Armoury.java
Ian Grigg
iang@cypherpunks.ai
Mon, 26 Feb 2001 21:23:29 -0400 (AST)
iang 01/02/26 21:23:29
Modified: webfunds/sox Armoury.java
Log:
minor comment changes and new static, whilst checking out bug report
(didn't find the infamous DOS bug)
Revision Changes Path
1.31 +23 -7 java/webfunds/sox/Armoury.java
Index: Armoury.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Armoury.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- Armoury.java 2000/08/05 13:00:09 1.30
+++ Armoury.java 2001/02/27 01:23:29 1.31
@@ -1,4 +1,4 @@
-/* $Id: Armoury.java,v 1.30 2000/08/05 13:00:09 iang Exp $
+/* $Id: Armoury.java,v 1.31 2001/02/27 01:23:29 iang Exp $
*
* Copyright (c) Systemics Inc. 1995-2000 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -36,10 +36,20 @@
* <a href="http://www.imc.org/rfc2045">http://www.imc.org/rfc2045</a>
* </ol>
*
- * @version $Revision: 1.30 $
+ * @version $Revision: 1.31 $
*/
public abstract class Armoury
{
+ /**
+ * Platform-dependant newline for the outgoing displayed payment
+ * (not to be used in calculation of sigs, etc).
+ */
+ static final String newline = System.getProperty("line.separator");
+
+//
+// This is a bit dumb, we should make the encoder an object
+// so that we can diagnose the failed results.
+//
static int linecount = 0;
private static final int
WAITING = 0,
@@ -50,6 +60,14 @@
SIGNED_DATA_START = 5;
/**
+ * Obviously not thread-relevant!
+ */
+ static public String getErrors()
+ {
+ return "line == " + linecount;
+ }
+
+ /**
* Encode <i>data</i> as a String using base64 encoding.
*
* @param data the data to be encoded
@@ -327,13 +345,11 @@
*/
public static String encode(String type, byte[] data)
{
- String newline = System.getProperty("line.separator");
return encode(type, data, "Version: 2.0.0" + newline + "Comment: SOX by Systemics");
}
public static String encode(String type, byte[] data, String headers)
{
- String newline = System.getProperty("line.separator");
return newline + "-----BEGIN "+type+"-----" + newline +
headers + newline + newline + encodeWithChecksum(data) +
"-----END "+type+"-----" + newline;
@@ -473,7 +489,6 @@
throws IOException,FileNotFoundException ,java.security.KeyException
{
BufferedReader bufr = new BufferedReader(new InputStreamReader (new ByteArrayInputStream(data)));
- String newline = System.getProperty("line.separator");
String result = "-----BEGIN "+"SIGNED DATA"+"-----" + newline;
String line;
@@ -494,9 +509,10 @@
}
/**
- * This method returns the data part of a signed message
- * removing the -(space) and changing line endings to local format.
+ * This method returns the data part of a signed message
+ * removing the -(space) and changing line endings to local format.
*
+ * Used by Ricardian Contracts.
*/
public static byte[] decodeData(byte[] data)
throws IOException