Author: juiceman
Date: 2007-09-10 04:00:24 +0000 (Mon, 10 Sep 2007)
New Revision: 15106

Modified:
   trunk/freenet/src/freenet/keys/CHKBlock.java
   trunk/freenet/src/freenet/keys/ClientCHKBlock.java
   trunk/freenet/src/freenet/keys/InsertableClientSSK.java
   trunk/freenet/src/freenet/keys/Key.java
   trunk/freenet/src/freenet/node/NodeCrypto.java
Log:
Remove more pre-1010 cruft.  Review encouraged

Modified: trunk/freenet/src/freenet/keys/CHKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/CHKBlock.java        2007-09-10 03:23:13 UTC 
(rev 15105)
+++ trunk/freenet/src/freenet/keys/CHKBlock.java        2007-09-10 04:00:24 UTC 
(rev 15106)
@@ -44,13 +44,8 @@
     }

     public static CHKBlock construct(byte[] data, byte[] header) throws 
CHKVerifyException {
-       try {
-               return new CHKBlock(data, header, null, true, 
Key.ALGO_AES_PCFB_256_SHA256);
-       } catch (CHKVerifyException e) {
-               // FIXME remove back compatibility code
-               return new CHKBlock(data, header, null, true, 
Key.ALGO_INSECURE_AES_PCFB_256_SHA256);
-       }
-    }
+       return new CHKBlock(data, header, null, true, 
Key.ALGO_AES_PCFB_256_SHA256);
+     }

     public CHKBlock(byte[] data2, byte[] header2, NodeCHK key) throws 
CHKVerifyException {
        this(data2, header2, key, key.cryptoAlgorithm);

Modified: trunk/freenet/src/freenet/keys/ClientCHKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientCHKBlock.java  2007-09-10 03:23:13 UTC 
(rev 15105)
+++ trunk/freenet/src/freenet/keys/ClientCHKBlock.java  2007-09-10 04:00:24 UTC 
(rev 15106)
@@ -75,8 +75,7 @@
      */
     public Bucket decode(BucketFactory bf, int maxLength, boolean 
dontCompress) throws CHKDecodeException, IOException {
         // Overall hash already verified, so first job is to decrypt.
-               if((!(key.cryptoAlgorithm == Key.ALGO_AES_PCFB_256_SHA256 ||
-                               key.cryptoAlgorithm == 
Key.ALGO_INSECURE_AES_PCFB_256_SHA256)))
+               if(key.cryptoAlgorithm != Key.ALGO_AES_PCFB_256_SHA256)
             throw new UnsupportedOperationException();
         BlockCipher cipher;
         try {

Modified: trunk/freenet/src/freenet/keys/InsertableClientSSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/InsertableClientSSK.java     2007-09-10 
03:23:13 UTC (rev 15105)
+++ trunk/freenet/src/freenet/keys/InsertableClientSSK.java     2007-09-10 
04:00:24 UTC (rev 15106)
@@ -48,22 +48,17 @@

                byte[] extra = uri.getExtra();
                if(uri.getKeyType().equals("SSK")) {
-                       // FIXME: Remove once all SSKs migrated.
-                       if(extra == null) {
-                               keyType = Key.ALGO_INSECURE_AES_PCFB_256_SHA256;
-                       } else {
-                               // Formatted exactly as ,extra on fetching
-                               if(extra.length < 5)
-                                       throw new MalformedURLException("SSK 
private key ,extra too short");
-                               if(extra[1] != 1) {
-                                       throw new MalformedURLException("SSK 
not a private key");
-                               }
-                               keyType = extra[2];
-                               if(!(keyType == Key.ALGO_AES_PCFB_256_SHA256 ||
-                                               keyType == 
Key.ALGO_INSECURE_AES_PCFB_256_SHA256))
-                                       throw new 
MalformedURLException("Unrecognized crypto type in SSK private key");
+                       // Formatted exactly as ,extra on fetching
+                       if(extra.length < 5)
+                               throw new MalformedURLException("SSK private 
key ,extra too short");
+                       if(extra[1] != 1) {
+                               throw new MalformedURLException("SSK not a 
private key");
                        }
-               } else {
+                       keyType = extra[2];
+                       if(keyType != Key.ALGO_AES_PCFB_256_SHA256)
+                               throw new MalformedURLException("Unrecognized 
crypto type in SSK private key");
+               }
+               else {
                        throw new MalformedURLException("Not a valid SSK insert 
URI type: "+uri.getKeyType());
                }

@@ -233,10 +228,5 @@
        public DSAGroup getCryptoGroup() {
                return Global.DSAgroupBigA;
        }
-
-       /** If true, this SSK is using the old, back compatible, insecure 
crypto algorithm. FIXME remove with support for old crypto. */
-       public boolean isInsecure() {
-               return cryptoAlgorithm == Key.ALGO_INSECURE_AES_PCFB_256_SHA256;
-       }

 }

Modified: trunk/freenet/src/freenet/keys/Key.java
===================================================================
--- trunk/freenet/src/freenet/keys/Key.java     2007-09-10 03:23:13 UTC (rev 
15105)
+++ trunk/freenet/src/freenet/keys/Key.java     2007-09-10 04:00:24 UTC (rev 
15106)
@@ -38,11 +38,7 @@

     /** Code for 256-bit AES with PCFB and SHA-256 */
     static final byte ALGO_AES_PCFB_256_SHA256 = 2;
-    /** Code for old, insecure (only encrypts first 128 bits of block) 256-bit 
AES with PCFB and SHA-256.
-     * FIXME: REMOVE!! */
-       static final byte ALGO_INSECURE_AES_PCFB_256_SHA256 = 1;

-
     protected Key(byte[] routingKey) {
        this.routingKey = routingKey;
        hash = Fields.hashCode(routingKey);

Modified: trunk/freenet/src/freenet/node/NodeCrypto.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeCrypto.java      2007-09-10 03:23:13 UTC 
(rev 15105)
+++ trunk/freenet/src/freenet/node/NodeCrypto.java      2007-09-10 04:00:24 UTC 
(rev 15106)
@@ -188,9 +188,7 @@
                        if(privARK != null) {
                                FreenetURI uri = new FreenetURI(privARK);
                                ark = InsertableClientSSK.create(uri);
-                               if(ark.isInsecure() || s == null) {
-                                       if(ark.isInsecure())
-                                               System.out.println("Creating 
new ARK, old is insecure");
+                               if(s == null) {
                                        ark = null;
                                        myARKNumber = 0;
                                } else {


Reply via email to