Blob Blame History Raw
--- /usr/src/redhat/BUILD/azureus2/com/aelitis/azureus/core/security/impl/CryptoSTSEngineImpl.java.~1.2.~	2006-07-08 12:02:26.000000000 -0700
+++ /usr/src/redhat/BUILD/azureus2/com/aelitis/azureus/core/security/impl/CryptoSTSEngineImpl.java	2006-07-08 12:01:51.000000000 -0700
@@ -28,6 +28,9 @@
 import java.security.PublicKey;
 import java.security.SecureRandom;
 import java.security.Signature;
+import java.security.Key;
+import java.security.InvalidKeyException;
+import java.security.InvalidAlgorithmParameterException;
 
 import org.bouncycastle.jce.provider.JCEECDHKeyAgreement;
 
@@ -54,7 +57,36 @@
 	private PublicKey 	remotePubKey;
 	private byte[] 		sharedSecret;
 	
-	private JCEECDHKeyAgreement ecDH;
+	private InternalDH ecDH;
+
+    class InternalDH extends JCEECDHKeyAgreement.DH
+    {
+    public void
+    init(
+    	Key		key )
+    
+    	throws InvalidKeyException, InvalidAlgorithmParameterException
+    {
+    	engineInit( key, null );
+    }
+
+    public Key
+    doPhase(
+    	Key		key,
+    	boolean	lastPhase )
+    
+    	throws InvalidKeyException, IllegalStateException
+    {
+    	return( engineDoPhase( key, lastPhase ));
+    }
+
+    public byte[] 
+    generateSecret() 
+    	throws IllegalStateException
+    {
+    	return( engineGenerateSecret());
+    }
+    }
 	
 	/**
 	 * 
@@ -75,7 +107,7 @@
 		ephemeralKeyPair = handler.createKeys();
 		
 		try{
-			ecDH = new JCEECDHKeyAgreement.DH();
+			ecDH = new InternalDH();
 			
 			//ecDH = KeyAgreement.getInstance("ECDH", "BC");