r27191 - in trunk/freenet/src/freenet: crypt node

[email protected] Wed, 22 Apr 2009 06:25:33 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: j16sdiz
Date: 2009-04-22 06:25:31 +0000 (Wed, 22 Apr 2009)
New Revision: 27191

Modified:
   trunk/freenet/src/freenet/crypt/HMAC.java
   trunk/freenet/src/freenet/node/FNPPacketMangler.java
Log:
Throw exception when crypro not supported

Modified: trunk/freenet/src/freenet/crypt/HMAC.java
===================================================================
--- trunk/freenet/src/freenet/crypt/HMAC.java	2009-04-22 05:39:06 UTC (rev 27190)
+++ trunk/freenet/src/freenet/crypt/HMAC.java	2009-04-22 06:25:31 UTC (rev 27191)
@@ -84,6 +84,7 @@
 		try {
 			s = new HMAC(MessageDigest.getInstance("SHA1"));
 		} catch(NoSuchAlgorithmException e) {
+			throw new RuntimeException(e);
 		}
 		byte[] key = new byte[20];
 		System.err.println("20x0b, 'Hi There':");

Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java	2009-04-22 05:39:06 UTC (rev 27190)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java	2009-04-22 06:25:31 UTC (rev 27191)
@@ -1045,7 +1045,7 @@
 		if(logMINOR) Logger.minor(this, "Got a JFK(3) message, processing it - "+pn);
 		
 		BlockCipher c = null;
-		try { c = new Rijndael(256, 256); } catch (UnsupportedCipherException e) {}
+		try { c = new Rijndael(256, 256); } catch (UnsupportedCipherException e) { throw new RuntimeException(e); }
 		
 		final int expectedLength =	
 			NONCE_SIZE*2 + // Ni, Nr
@@ -1197,7 +1197,7 @@
 		pn.receivedPacket(true, false);
 		
 		BlockCipher cs = null;
-		try { cs = new Rijndael(256, 256); } catch (UnsupportedCipherException e) {}
+		try { cs = new Rijndael(256, 256); } catch (UnsupportedCipherException e) { throw new RuntimeException(e); }
 		cs.initialize(Ks);
 		
 		// Promote if necessary
@@ -1305,7 +1305,7 @@
 				Logger.error(this, error);
 		}
 		BlockCipher c = null;
-		try { c = new Rijndael(256, 256); } catch (UnsupportedCipherException e) {}
+		try { c = new Rijndael(256, 256); } catch (UnsupportedCipherException e) { throw new RuntimeException(e); }
 		
 		final int expectedLength =
 			HASH_LENGTH + // HMAC of the cyphertext
@@ -1484,7 +1484,7 @@
 		if(logMINOR) Logger.minor(this, "Sending a JFK(3) message to "+pn.getPeer());
 		long t1=System.currentTimeMillis();
 		BlockCipher c = null;
-		try { c = new Rijndael(256, 256); } catch (UnsupportedCipherException e) {}
+		try { c = new Rijndael(256, 256); } catch (UnsupportedCipherException e) { throw new RuntimeException(e); }
 		DiffieHellmanLightContext ctx = (DiffieHellmanLightContext) pn.getKeyAgreementSchemeContext();
 		if(ctx == null) return;
 		byte[] ourExponential = stripBigIntegerToNetworkFormat(ctx.myExponential);