[Webfunds-commits] java/webfunds/sox Token.java

Ian Grigg iang@cypherpunks.ai
Tue, 5 Dec 2000 13:41:13 -0400 (AST)


iang        00/12/05 13:41:13

  Modified:    webfunds/sox Token.java
  Log:
  changed over batching of tokens to series string from expiry date

Revision  Changes    Path
1.5       +39 -5     java/webfunds/sox/Token.java

Index: Token.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Token.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Token.java	2000/11/30 13:42:47	1.4
+++ Token.java	2000/12/05 17:41:13	1.5
@@ -1,5 +1,5 @@
 /*
- * $Id: Token.java,v 1.4 2000/11/30 13:42:47 iang Exp $
+ * $Id: Token.java,v 1.5 2000/12/05 17:41:13 iang Exp $
  *
  * Copyright (c) Systemics Inc 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -13,6 +13,7 @@
 import java.io.OutputStream;
 import java.io.DataOutputStream;
 
+import java.security.KeyPair;
 import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.KeyException;
@@ -121,11 +122,14 @@
     public long getQty()             { return PaymentFactory.log2qty(log); }
 
     /**
-     *  Tokens commonly come from a batch with a defined expiry date.
-     *  This is interpreted by the subclass, may be ignored.
+     *  Tokens commonly come from a batch that is identified
+     *  with a series label or an expiry date.
+     *  These are interpreted by the subclass, may be ignored.
      */
     protected long expiry;
     public long getExpiry()                     { return expiry; }
+    protected byte[] series;
+    public byte[] getSeries()                   { return series; }
 
     /**
      *  The token payload
@@ -187,12 +191,21 @@
      *
      *  @param expiry the Java time when this (batch) expires
      *  @param key is the signing key of the mint
-     */
     public abstract void sign(PrivateKey key, long expiry)
         throws KeyException;
+     */
+    /**
+     *  Sign a protocoin.
+     *  Alternative to expressing expiry is to set a series.
+     *
+     *  @param series is a string identifying batch
+     *  @param key is the signing key of the mint
+     */
+    public abstract void sign(PrivateKey key, byte[] series)
+        throws KeyException;
     /**
      *  Sign a protocoin.
-     *  Normally called by client to check the coin is signed,
+     *  Normally called by client & server to check the coin is signed,
      *  matched pair with sign() so it can be a standardised call.
      *
      *  @param key is the signer's public key (of the mint)
@@ -200,6 +213,27 @@
     public abstract boolean verify(PublicKey key)
         throws KeyException;
 
+    /**
+     *  Get the unique identifier that is used for checking against
+     *  double-spending.
+     *  Normally called by server on depositing.
+     *  Only makes sense if in state TOK_SIGNED or later.
+     *
+     *  @param key is the signer's public key (of the mint)
+     */
+    public abstract byte[] getUniqueId();
+
+    /**
+     *  Create a PrivateKey and matching PublicKey for signing
+     *  the tokens.
+     *  This is really a static call, not to do with the object.
+     *  It also needs to be audited by the Issuer.
+     *
+     *  @param series is a string identifying batch
+     *  @param log is the value number that applies for this key
+    public static abstract KeyPair createKeyPair(byte[] series, int log)
+        throws SOXKeyException;
+     */