/[storm]/storm/org/nongnu/storm/pointers/PointerIndex.java
ViewVC logotype

Diff of /storm/org/nongnu/storm/pointers/PointerIndex.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by benja, Fri May 9 15:52:47 2003 UTC revision 1.3 by benja, Fri May 9 16:42:23 2003 UTC
# Line 33  import java.io.*; Line 33  import java.io.*;
33  import java.security.*;  import java.security.*;
34    
35  public class PointerIndex {  public class PointerIndex {
36      public static boolean dbg = true;      public static boolean dbg = false;
37      private static void p(String s) { System.out.println("PointerIndex:: "+s); }      private static void p(String s) { System.out.println("PointerIndex:: "+s); }
38    
39      public static final String uri =      public static final String uri =
# Line 82  public class PointerIndex { Line 82  public class PointerIndex {
82          return result;          return result;
83      }      }
84    
85      public void set(PointerId id, BlockId target, PrivateKey key)      public void set(PointerId id, BlockId target, KeyPair keyPair)
86          throws IOException, GeneralSecurityException {          throws IOException, GeneralSecurityException {
87          // XXX this assumes that the computer clock          // XXX this assumes that the computer clock
88          // is always set correctly: if there is an existing          // is always set correctly: if there is an existing
# Line 91  public class PointerIndex { Line 91  public class PointerIndex {
91          // actually change the pointer...          // actually change the pointer...
92          long timestamp = System.currentTimeMillis();          long timestamp = System.currentTimeMillis();
93    
94            byte[] keyBytes =
95                PointerId.getKeyBytes(keyPair.getPublic());
96    
97          String data =          String data =
98              id.toString() + "\n" +              id.toString() + "\n" +
99                Base32.encode(keyBytes) + "\n" +
100              timestamp + "\n" +              timestamp + "\n" +
101              target.toString();              target.toString();
102    
103          Signature s = Signature.getInstance("SHA1withDSA");          Signature s = Signature.getInstance("SHA1withDSA");
104          s.initSign(key);          s.initSign(keyPair.getPrivate());
105          s.update(data.getBytes("US-ASCII"));          s.update(data.getBytes("US-ASCII"));
106          byte[] signature = s.sign();          byte[] signature = s.sign();
107    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26