[freenet-cvs] r14823 - branches/freenet-jfk/src/freenet/crypt/crypto_Random

kryptos at freenetproject.org kryptos at freenetproject.org
Tue Aug 21 11:48:06 UTC 2007


Author: kryptos
Date: 2007-08-21 11:48:06 +0000 (Tue, 21 Aug 2007)
New Revision: 14823

Removed:
   branches/freenet-jfk/src/freenet/crypt/crypto_Random/HKrGenerator.java
   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
Modified:
   branches/freenet-jfk/src/freenet/crypt/crypto_Random/session_Key.java
   branches/freenet-jfk/src/freenet/crypt/crypto_Random/sharedSecretKey1.java
   branches/freenet-jfk/src/freenet/crypt/crypto_Random/sharedSecretKey2.java
Log:
crypto key support files

Deleted: branches/freenet-jfk/src/freenet/crypt/crypto_Random/HKrGenerator.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/HKrGenerator.java	2007-08-21 11:30:19 UTC (rev 14822)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/HKrGenerator.java	2007-08-21 11:48:06 UTC (rev 14823)
@@ -1,17 +0,0 @@
-import java.io.*;
-import freenet.node.*;
-public class HKrGenerator{
-    private byte[] hashKey;
-    public HKrGenerator(){
-        hashKey = new byte[20];
-    }
-    public HKrGenerator(int size){
-        hashKey = new byte[size];
-    }
-
-    public byte[] getNewHKr() throws Exception{
-        node.random.nextBytes(hashKey);
-        return hashKey;
-    }
-}
-

Deleted: branches/freenet-jfk/src/freenet/crypt/crypto_Random/grpInfo.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/grpInfo.java	2007-08-21 11:30:19 UTC (rev 14822)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/grpInfo.java	2007-08-21 11:48:06 UTC (rev 14823)
@@ -1,56 +0,0 @@
-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=new byte[3];
-	public void processData(){
-        	if (grpInfo.length == 3)
-		{
-            		int enc = grpInfo[0] & 0xFF;
-            		encryptionAlgorithm = getEncryptionAlgorithm(enc);
-            		int sig = grpInfo[1] & 0xFF;
-            		signatureAlgorithm  = getSignatureAlgorithm(sig);
-            		int hash = grpInfo[2] & 0xFF;
-            		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 encVal){
-        	return algorithm.getAlgo(encVal);
-	}
-
-	/**
-	 * Method getSignatureAlgorithm returns the signature algorithm name 
-	 * extracted from calling processData method.
-	 * 
-	 * @return String
-	 */
-	public String getSignatureAlgorithm(int sigVal){
-        	return algorithm.getAlgo(sigVal);
-    	}
-
-	/**
-	 * Method getHashAlgorithm returns the hash algorithm name 
-	 * extracted from calling processData method.
-	 * 
-	 * @return String
-	 */
-    	public String getHashAlgorithm(int hashVal){
-        	return algorithm.getAlgo(hashVal);
-    	}
-}
-

Deleted: branches/freenet-jfk/src/freenet/crypt/crypto_Random/nonceGen.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/nonceGen.java	2007-08-21 11:30:19 UTC (rev 14822)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/nonceGen.java	2007-08-21 11:48:06 UTC (rev 14823)
@@ -1,16 +0,0 @@
-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;
-	}
-}
-		

Modified: branches/freenet-jfk/src/freenet/crypt/crypto_Random/session_Key.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/session_Key.java	2007-08-21 11:30:19 UTC (rev 14822)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/session_Key.java	2007-08-21 11:48:06 UTC (rev 14823)
@@ -1,14 +1,11 @@
 package freenet.crypt;
 import java.io.*;
 import java.util.*;
-import java.lang.*;
+import java.lang.Integer;
+import freenet.crypt.HMAC;
 public class session_Key
 {
-	/*
-	 * Constructor
-	 */
-	private session_Key{
-	}
+	
 	/**
           *Session key.
           *The key is generated from Hash of Message:(Ni, Nr, 0) using the DF exponentials
@@ -22,7 +19,7 @@
             		byte[] byteArray=new byte[Ni.length + Nr.length + 1];
             		System.arraycopy(Ni,0,byteArray,0,Ni.length);
             		System.arraycopy(Nr,0,byteArray,Ni.length,Nr.length);
-            		byteArray[Ni.length + Nr.length]=Integer(0).byteValue();
+            		byteArray[Ni.length + Nr.length]=(new Integer(0)).byteValue();
 			HMAC s = new HMAC(SHA1.getInstance());
 			return s.mac(DFExp,byteArray,DFExp.length);
         	}catch(Exception e){

Modified: branches/freenet-jfk/src/freenet/crypt/crypto_Random/sharedSecretKey1.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/sharedSecretKey1.java	2007-08-21 11:30:19 UTC (rev 14822)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/sharedSecretKey1.java	2007-08-21 11:48:06 UTC (rev 14823)
@@ -4,11 +4,7 @@
 import java.io.*;
 public class sharedSecretKey1
 {
-        /*
-         * Constructor
-         */
-        private sharedSecretKey1{
-        }
+        
         /**
           *Shared key.
           *The key is generated from Hash of Message:(Ni, Nr, 1) using the DF exponentials
@@ -22,7 +18,7 @@
                         byte[] byteArray=new byte[Ni.length + Nr.length + 1];
                         System.arraycopy(Ni,0,byteArray,0,Ni.length);
                         System.arraycopy(Nr,0,byteArray,Ni.length,Nr.length);
-                        byteArray[Ni.length + Nr.length]=Integer(0).byteValue();
+                        byteArray[Ni.length + Nr.length]=(new Integer(1)).byteValue();
                         HMAC s = new HMAC(SHA1.getInstance());
                         return s.mac(DFExp,byteArray,DFExp.length);
                 }catch(Exception e){

Modified: branches/freenet-jfk/src/freenet/crypt/crypto_Random/sharedSecretKey2.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/sharedSecretKey2.java	2007-08-21 11:30:19 UTC (rev 14822)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/sharedSecretKey2.java	2007-08-21 11:48:06 UTC (rev 14823)
@@ -4,11 +4,7 @@
 import java.io.*;
 public class sharedSecretKey2
 {
-        /*
-         * Constructor
-         */
-        private sharedSecretKey2{
-        }
+       
         /**
           *Shared key.
           *The key is generated from Hash of Message:(Ni, Nr, 2) using the DF exponentials
@@ -22,7 +18,7 @@
                         byte[] byteArray=new byte[Ni.length + Nr.length + 1];
                         System.arraycopy(Ni,0,byteArray,0,Ni.length);
                         System.arraycopy(Nr,0,byteArray,Ni.length,Nr.length);
-                        byteArray[Ni.length + Nr.length]=Integer(0).byteValue();
+                        byteArray[Ni.length + Nr.length]=(new Integer(2)).byteValue();
                         HMAC s = new HMAC(SHA1.getInstance());
                         return s.mac(DFExp,byteArray,DFExp.length);
                 }catch(Exception e){

Deleted: branches/freenet-jfk/src/freenet/crypt/crypto_Random/updateTransientKey.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/crypto_Random/updateTransientKey.java	2007-08-21 11:30:19 UTC (rev 14822)
+++ branches/freenet-jfk/src/freenet/crypt/crypto_Random/updateTransientKey.java	2007-08-21 11:48:06 UTC (rev 14823)
@@ -1,26 +0,0 @@
-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();
-			}
-		}
-	}
-}
-			
-




More information about the cvs mailing list