[Webfunds-commits] java/webfunds/ricardian Contract.java
Ian Grigg
iang@cypherpunks.ai
Fri, 13 Apr 2001 13:10:23 -0400 (AST)
iang 01/04/13 13:10:23
Modified: webfunds/ricardian Contract.java
Log:
1. fixed one Doh! with logmsg();
2. created new methods for getting the Contract contents, with Sig,
stripped of Sig. getContentsWithSignature(), getContentsStrippedOfSig().
old method can be deprecated: getContents() (this was done so that the
ContractBrowser/Chooser can display the whole contract with Sig, without
confusing the meaning.
Revision Changes Path
1.56 +41 -8 java/webfunds/ricardian/Contract.java
Index: Contract.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/Contract.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- Contract.java 2001/04/13 16:46:20 1.55
+++ Contract.java 2001/04/13 17:10:22 1.56
@@ -1,6 +1,6 @@
-/* $Id: Contract.java,v 1.55 2001/04/13 16:46:20 iang Exp $
+/* $Id: Contract.java,v 1.56 2001/04/13 17:10:22 iang Exp $
*
- * Copyright (c) Systemics Ltd 1995-1999 on behalf of
+ * Copyright (c) 1995-2001 Systemics Inc on behalf of
* the WebFunds Development Team. All Rights Reserved.
*/
package webfunds.ricardian;
@@ -1195,6 +1195,9 @@
}
/**
+ * Holds a printable chain of valid key Ids after verifying
+ * signature on a contract is good. Indicative only.
+ *
* @return the (string) type of signature technology used.
*/
public String getSignatureTypeString()
@@ -1238,8 +1241,8 @@
Certificate contractCert = getContractCert();
- logmsg.println("contract C: " + contractCert);
- logmsg.println("topLevel C: " + topLevelCert);
+ logmsg("contract C: " + contractCert);
+ logmsg("topLevel C: " + topLevelCert);
/*
* No cert path for signing key yet, may be signed by intermediate
@@ -1278,10 +1281,10 @@
PGPKeyID contractId = contractKey.getKeyID();
PGPKeyID topLevelId = topLevelKey.getKeyID();
- logmsg.println("contract : " + contractKey);
- logmsg.println("topLevel : " + topLevelKey);
- logmsg.println("contractId: " + contractId);
- logmsg.println("topLevelId: " + topLevelId);
+ logmsg("contract : " + contractKey);
+ logmsg("topLevel : " + topLevelKey);
+ logmsg("contractId: " + contractId);
+ logmsg("topLevelId: " + topLevelId);
if (contractId == null)
throw new ContractException(ContractException.KEY_CONTRACT,
"no KeyId within key??");
@@ -1721,6 +1724,36 @@
fos.close();
}
+ /** Get the Contract with the cleartext signature intact. */
+ public String getContentsWithSignature()
+ throws IOException
+ {
+ return new String(contractData);
+ }
+
+ /** Get the Contract with the cleartext signature stripped off. */
+ public String getContentsStrippedOfSig()
+ throws IOException
+ {
+ String s = getContentsWithSignature();
+
+ if (isOpenPGP()) {
+
+ PGPArmoury pgparmoury = new PGPArmoury(s);
+ return new String(pgparmoury.getClearText());
+
+ } else if (isX509()) {
+
+ return new String(Armoury.decodeData(contractData));
+
+ } else {
+ throw new IOException("failed to determine Contract type: " +
+ getSignatureTypeString());
+ }
+
+ }
+
+ /** XXX: deprecate this name */
public String getContents()
throws IOException
{