[Webfunds-commits] java/webfunds/ricardian Contract.java
Edwin Woudt
edwin@cypherpunks.ai
Mon, 7 Aug 2000 20:05:34 -0400 (AST)
edwin 00/08/07 20:05:34
Modified: webfunds/ricardian Contract.java
Log:
Correctly return the contents of an OpenPGP signed contract.
(the contract browser and contract chooser now show the contract)
Revision Changes Path
1.28 +15 -2 java/webfunds/ricardian/Contract.java
Index: Contract.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/Contract.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- Contract.java 2000/08/07 18:39:18 1.27
+++ Contract.java 2000/08/08 00:05:34 1.28
@@ -1,4 +1,4 @@
-/* $Id: Contract.java,v 1.27 2000/08/07 18:39:18 edwin Exp $
+/* $Id: Contract.java,v 1.28 2000/08/08 00:05:34 edwin Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -1177,7 +1177,20 @@
public String getContents()
throws IOException
{
- return new String(Armoury.decodeData(contractData));
+ String s = new String(contractData);
+
+ // ### FIXME (edwin): Figure out a better way to check this
+ if (s.startsWith("-----BEGIN PGP SIGNED MESSAGE-----")) {
+
+ PGPArmoury pgparmoury = new PGPArmoury(s);
+ return new String(pgparmoury.getClearText());
+
+ } else { // X.509 signed contract
+
+ return new String(Armoury.decodeData(contractData));
+
+ }
+
}