Blob Blame History Raw
--- com/aelitis/azureus/core/security/impl/CryptoHandlerECC.java.~1.3.~	2006-07-08 11:50:24.000000000 -0700
+++ com/aelitis/azureus/core/security/impl/CryptoHandlerECC.java	2006-07-08 11:49:50.000000000 -0700
@@ -31,8 +31,14 @@
 import java.security.PublicKey;
 import java.security.Signature;
 import java.security.spec.KeySpec;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.SecureRandom;
+import java.security.InvalidKeyException;
+import java.security.InvalidAlgorithmParameterException;
 
 import javax.crypto.Cipher;
+import javax.crypto.BadPaddingException;
+import javax.crypto.IllegalBlockSizeException;
 
 import org.bouncycastle.jce.ECNamedCurveTable;
 import org.bouncycastle.jce.interfaces.ECPrivateKey;
@@ -200,6 +206,26 @@
 	{
 		return( encrypt( other_public_key, data, null, reason ));
 	}
+
+    class InternalECIES extends JCEIESCipher.ECIES
+    {
+	public void internalEngineInit(int                     opmode,
+				       Key                     key,
+				       AlgorithmParameterSpec  params,
+				       SecureRandom            random) 
+	    throws InvalidKeyException, InvalidAlgorithmParameterException
+	{
+	    engineInit(opmode, key, params, random);
+	}
+
+    protected byte[] internalEngineDoFinal(byte[]  input,
+					   int     inputOffset,
+					   int     inputLen) 
+        throws IllegalBlockSizeException, BadPaddingException
+	{
+	    return engineDoFinal(input, inputOffset, inputLen);
+	}
+    }
 	
 	protected byte[]
 	encrypt(
@@ -215,11 +241,11 @@
 	 
 			IESParameterSpec param = new IESParameterSpec(ECIES_D, ECIES_E, 128);
 		
-			JCEIESCipher	cipher = new JCEIESCipher.ECIES();
+			InternalECIES	cipher = new InternalECIES();
 	
-			cipher.engineInit( Cipher.ENCRYPT_MODE, key_spec, param, null ); 
+			cipher.internalEngineInit( Cipher.ENCRYPT_MODE, key_spec, param, null ); 
 		
-			return( cipher.engineDoFinal(data, 0, data.length ));
+			return( cipher.internalEngineDoFinal(data, 0, data.length ));
 			
 		}catch( CryptoManagerException e ){
 			
@@ -267,11 +293,11 @@
 	 	
 			IESParameterSpec param = new IESParameterSpec(ECIES_D, ECIES_E, 128);
 		
-			JCEIESCipher	cipher = new JCEIESCipher.ECIES();
+			InternalECIES	cipher = new InternalECIES();
 	
-			cipher.engineInit( Cipher.DECRYPT_MODE, key_spec, param, null ); 
+			cipher.internalEngineInit( Cipher.DECRYPT_MODE, key_spec, param, null ); 
 		
-			return( cipher.engineDoFinal(data, 0, data.length ));
+			return( cipher.internalEngineDoFinal(data, 0, data.length ));
 			
 		}catch( CryptoManagerException e ){