Author: kryptos
Date: 2007-07-08 14:58:40 +0000 (Sun, 08 Jul 2007)
New Revision: 13990
Added:
branches/freenet-jfk/src/freenet/crypt/crypto_Random/grpInfo.java
branches/freenet-jfk/src/freenet/crypt/crypto_Random/nonceGen.java
branches/freenet-jfk/src/freenet/crypt/crypto_Random/updateTransientKey.java
Log:
Some JFK computations;Responder and initiator methods to be added
Added: branches/freenet-jfk/src/freenet/crypt/crypto_Random/grpInfo.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/grpInfo.java
(rev 0)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/grpInfo.java
2007-07-08 14:58:40 UTC (rev 13990)
@@ -0,0 +1,56 @@
+public class grpInfo{
+ public grpInfo(byte[] input){
+ grpInfo = new byte[input.length];
+ System.arraycopy(input,0,grpInfo,0,input.length);
+ }
+ private String encryptionAlgorithm;
+ private String signatureAlgorithm;
+ private String hashAlgorithm;
+ private byte[] grpInfo;
+ public void processData(){
+ if (grpInfo.length == 3)
+ {
+ int enc = (new Byte(grpInfo[0])).intValue();
+ encryptionAlgorithm = getEncryptionAlgorithm(enc);
+ int sig = (new Byte(grpInfo[1])).intValue();
+ signatureAlgorithm = getSignatureAlgorithm(sig);
+ int hash = (new Byte(grpInfo[2])).intValue();
+ hashAlgorithm = getHashAlgorithm(hash);
+ return;
+ }
+ else
+ System.err.println("ERROR");
+
+
+
+ /**
+ * Method getEncryptionAlgorithm returns the encryption algorithm name
+ * extracted from the processData method.
+ *
+ * @return String
+ */
+ public String getEncryptionAlgorithm(int val){
+ return encryptionAlgorithm;
+ }
+
+ /**
+ * Method getSignatureAlgorithm returns the signature algorithm name
+ * extracted from calling processData method.
+ *
+ * @return String
+ */
+ public String getSignatureAlgorithm(){
+ return signatureAlgorithm;
+ }
+
+ /**
+ * Method getHashAlgorithm returns the hash algorithm name
+ * extracted from calling processData method.
+ *
+ * @return String
+ */
+ public String getHashAlgorithm(){
+ return hashAlgorithm;
+ }
+}
+
Added: branches/freenet-jfk/src/freenet/crypt/crypto_Random/nonceGen.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/nonceGen.java
(rev 0)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/nonceGen.java
2007-07-08 14:58:40 UTC (rev 13990)
@@ -0,0 +1,16 @@
+import freenet.crypt;
+import java.util.*;
+public class nonceGen{
+ private byte nonce[];
+ public nonceGen(int size){
+ nonce=new byte[size];
+ }
+ public byte[] getNonce() throws Exception{
+ /*
+ * We get this from node.random rather than instantiating Yarrow
+ */
+ node.random.nextBytes(nonce);
+ return nonce;
+ }
+}
+
Added:
branches/freenet-jfk/src/freenet/crypt/crypto_Random/updateTransientKey.java
===================================================================
---
branches/freenet-jfk/src/freenet/crypt/crypto_Random/updateTransientKey.java
(rev 0)
+++
branches/freenet-jfk/src/freenet/crypt/crypto_Random/updateTransientKey.java
2007-07-08 14:58:40 UTC (rev 13990)
@@ -0,0 +1,26 @@
+import java.util.*;
+import java.lang.*;
+package freenet.crypt;
+public class updateTransientKey extends Thread{
+ Responder rs;
+ public int hkrPeriod;
+ public updateTransientKey(Responder rs)
+ {
+ this.rs=rs;
+ }
+ public void run()
+ {
+ while(true)
+ {
+ try
+ {
+ sleep(hkrPeriod);
+ rs.getHkr();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+ }
+}
+
+