Author: jonesde
Date: Thu Jul 26 05:27:22 2007 New Revision: 559792 URL: http://svn.apache.org/viewvc?view=rev&rev=559792 Log: Added a few verbose log messages to help with debugging; some crazy code in there Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/AliasKeyManager.java ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/HttpClient.java ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/SSLUtil.java Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/AliasKeyManager.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/AliasKeyManager.java?view=diff&rev=559792&r1=559791&r2=559792 ============================================================================== --- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/AliasKeyManager.java (original) +++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/AliasKeyManager.java Thu Jul 26 05:27:22 2007 @@ -30,6 +30,7 @@ * */ public class AliasKeyManager implements X509KeyManager { + public static final String module = X509KeyManager.class.getName(); protected X509KeyManager keyManager = null; protected String alias = null; @@ -43,37 +44,44 @@ // this is where the customization comes in public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) { - for (int i = 0; i < keyType.length; i++) { - String[] aliases = keyManager.getClientAliases(keyType[i], null); // ignoring the issuers - if (aliases != null && aliases.length > 0) { - for (int x = 0; x < aliases.length; x++) { - if (alias.equals(aliases[i])) { - return alias; - } - } - } - } - return null; + for (int i = 0; i < keyType.length; i++) { + String[] aliases = keyManager.getClientAliases(keyType[i], null); // ignoring the issuers + if (aliases != null && aliases.length > 0) { + for (int x = 0; x < aliases.length; x++) { + if (this.alias.equals(aliases[i])) { + if (Debug.verboseOn()) Debug.logVerbose("chooseClientAlias for keyType [" + keyType[i] + "] got alias " + this.alias, module); + //Debug.logInfo(new Exception(), "Location where chooseClientAlias is called", module); + return this.alias; + } + } + } + } + return null; } // these just pass through the keyManager public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) { - return keyManager.chooseServerAlias(keyType, issuers, socket); + return keyManager.chooseServerAlias(keyType, issuers, socket); } public X509Certificate[] getCertificateChain(String alias) { - return keyManager.getCertificateChain(alias); + X509Certificate[] certArray = keyManager.getCertificateChain(alias); + if (Debug.verboseOn()) Debug.logVerbose("getCertificateChain for alias [" + alias + "] got " + certArray.length + " results", module); + return certArray; } public String[] getClientAliases(String keyType, Principal[] issuers) { - return keyManager.getClientAliases(keyType, issuers); + return keyManager.getClientAliases(keyType, issuers); } public PrivateKey getPrivateKey(String alias) { - return keyManager.getPrivateKey(alias); + PrivateKey pk = keyManager.getPrivateKey(alias); + if (Debug.verboseOn()) Debug.logVerbose("getPrivateKey for alias [" + alias + "] got " + (pk == null ? "[Not Found!]" : "[alg:" + pk.getAlgorithm() + ";format:" + pk.getFormat() + "]"), module); + //Debug.logInfo(new Exception(), "Location where getPrivateKey is called", module); + return pk; } public String[] getServerAliases(String keyType, Principal[] issuers) { - return keyManager.getServerAliases(keyType, issuers); + return keyManager.getServerAliases(keyType, issuers); } } Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/HttpClient.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/HttpClient.java?view=diff&rev=559792&r1=559791&r2=559792 ============================================================================== --- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/HttpClient.java (original) +++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/HttpClient.java Thu Jul 26 05:27:22 2007 @@ -422,7 +422,7 @@ if ((con instanceof HttpURLConnection)) { ((HttpURLConnection) con).setInstanceFollowRedirects(followRedirects); - if (Debug.verboseOn() || debug) Debug.log("Connection is of type HttpURLConnection", module); + if (Debug.verboseOn() || debug) Debug.log("Connection is of type HttpURLConnection, more specifically: " + con.getClass().getName(), module); } // set the content type Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/SSLUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/SSLUtil.java?view=diff&rev=559792&r1=559791&r2=559792 ============================================================================== --- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/SSLUtil.java (original) +++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/SSLUtil.java Thu Jul 26 05:27:22 2007 @@ -88,7 +88,9 @@ if (ksi.isCertStore()) { KeyStore ks = ksi.getKeyStore(); if (ks != null) { - keyMgrs.addAll(Arrays.asList(getKeyManagers(ks, ksi.getPassword(), alias))); + List newKeyManagers = Arrays.asList(getKeyManagers(ks, ksi.getPassword(), alias)); + keyMgrs.addAll(newKeyManagers); + if (Debug.verboseOn()) Debug.logVerbose("Loaded another cert store, adding [" + (newKeyManagers == null ? "0" : newKeyManagers.size()) + "] KeyManagers for alias [" + alias + "] and keystore: " + ksi.createResourceHandler().getFullLocation(), module); } else { throw new IOException("Unable to load keystore: " + ksi.createResourceHandler().getFullLocation()); } |
Free forum by Nabble | Edit this page |