Author: keith
Date: Thu Jul 17 02:47:29 2008
New Revision: 19407
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19407

Log:
fixing mashup-961


Modified:
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java
   trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java?rev=19407&r1=19406&r2=19407&view=diff
==============================================================================
--- 
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java
   (original)
+++ 
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/CustomProtocolSocketFactory.java
   Thu Jul 17 02:47:29 2008
@@ -63,9 +63,10 @@
 
     private String username = null;
 
-    public CustomProtocolSocketFactory(String username) {
+    public CustomProtocolSocketFactory(String username) throws MashupFault {
         super();
         this.username = username;
+        getSSLContext();
     }
 
     private SSLContext createSSLContext() throws MashupFault {
@@ -96,10 +97,6 @@
             BufferedInputStream ksbufin = new BufferedInputStream(ksIn);
             String storePassword = keyStoreDO.getStorePassword();
             String privateKeyPassword = keyStoreDO.getPrivateKeyPassword();
-            if 
(MashupConstants.USER_KEY_STORE_PASS.equals(privateKeyPassword)) {
-                throw new MashupFault("You cannot communicate with https sites 
untill you " +
-                        "specify your private key. Please do so by vising the 
cert_manager.jsp page");
-            }
             CryptoUtil cryptoUtil =
                     new CryptoUtil(new File(config.getFirstProperty(
                             "Security.KeyStore.Location")).getAbsolutePath(),
@@ -107,10 +104,15 @@
                                    
config.getFirstProperty("Security.KeyStore.KeyAlias"),
                                    
config.getFirstProperty("Security.KeyStore.KeyPassword"),
                                    
config.getFirstProperty("Security.KeyStore.Type"));
+            char[] decryptedPrivateKeyPass =
+                                new 
String(cryptoUtil.base64DecodeAndDecrypt(privateKeyPassword)).toCharArray();
+            if (MashupConstants.DEFAULT_PRIVATE_KEY_ENTRY.equals(new 
String(decryptedPrivateKeyPass))) {
+                throw new MashupFault("You cannot communicate with https sites 
untill you " +
+                        "specify your private key. Please do so by vising the 
" +
+                        "<a href='cert_manager.jsp'>cert_manager.jsp</a> 
page");
+            }
             char[] decryptedStorePass =
                     new 
String(cryptoUtil.base64DecodeAndDecrypt(storePassword)).toCharArray();
-            char[] decryptedPrivateKeyPass =
-                    new 
String(cryptoUtil.base64DecodeAndDecrypt(privateKeyPassword)).toCharArray();
             keyStore.load(ksbufin, decryptedStorePass);
             
             keyManagerFactory.init(keyStore, decryptedPrivateKeyPass);

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java?rev=19407&r1=19406&r2=19407&view=diff
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java   
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java   
Thu Jul 17 02:47:29 2008
@@ -1392,7 +1392,7 @@
         return httpClient.executeMethod(config, method);
     }
 
-    public static ProtocolSocketFactory getCustomProtocolSocketFactory() {
+    public static ProtocolSocketFactory getCustomProtocolSocketFactory() 
throws MashupFault {
         MessageContext currentMessageContext =
                 MessageContext.getCurrentMessageContext();
 

_______________________________________________
Mashup-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to