From 50cdc254214407d48dcef9c65b146cc09ff4c9b3 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 29 Jan 2008 21:18:25 +0000 Subject: [PATCH] Tab police. No function change git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@616522 13f79535-47bb-0310-9956-ffa450edef68 --- .../util/net/puretls/PureTLSImplementation.java | 8 +- .../tomcat/util/net/puretls/PureTLSSocket.java | 2 +- .../util/net/puretls/PureTLSSocketFactory.java | 140 ++++++++++----------- .../tomcat/util/net/puretls/PureTLSSupport.java | 26 ++-- 4 files changed, 88 insertions(+), 88 deletions(-) diff --git a/java/org/apache/tomcat/util/net/puretls/PureTLSImplementation.java b/java/org/apache/tomcat/util/net/puretls/PureTLSImplementation.java index de2ea16e7..6176afdce 100644 --- a/java/org/apache/tomcat/util/net/puretls/PureTLSImplementation.java +++ b/java/org/apache/tomcat/util/net/puretls/PureTLSImplementation.java @@ -35,8 +35,8 @@ import COM.claymoresystems.ptls.SSLSocket; public class PureTLSImplementation extends SSLImplementation { public PureTLSImplementation() throws ClassNotFoundException { - // Check to see if PureTLS is floating around somewhere - Class.forName("COM.claymoresystems.ptls.SSLContext"); + // Check to see if PureTLS is floating around somewhere + Class.forName("COM.claymoresystems.ptls.SSLContext"); } public String getImplementationName(){ @@ -45,12 +45,12 @@ public class PureTLSImplementation extends SSLImplementation public ServerSocketFactory getServerSocketFactory() { - return new PureTLSSocketFactory(); + return new PureTLSSocketFactory(); } public SSLSupport getSSLSupport(Socket s) { - return new PureTLSSupport((SSLSocket)s); + return new PureTLSSupport((SSLSocket)s); } diff --git a/java/org/apache/tomcat/util/net/puretls/PureTLSSocket.java b/java/org/apache/tomcat/util/net/puretls/PureTLSSocket.java index 924f2c8fb..c566fe736 100644 --- a/java/org/apache/tomcat/util/net/puretls/PureTLSSocket.java +++ b/java/org/apache/tomcat/util/net/puretls/PureTLSSocket.java @@ -37,7 +37,7 @@ public class PureTLSSocket extends COM.claymoresystems.ptls.SSLSocket // constructor since this class is only used with // implAccept public PureTLSSocket() throws IOException { - super(); + super(); } } diff --git a/java/org/apache/tomcat/util/net/puretls/PureTLSSocketFactory.java b/java/org/apache/tomcat/util/net/puretls/PureTLSSocketFactory.java index 16305d2c0..2fa41c6eb 100644 --- a/java/org/apache/tomcat/util/net/puretls/PureTLSSocketFactory.java +++ b/java/org/apache/tomcat/util/net/puretls/PureTLSSocketFactory.java @@ -44,7 +44,7 @@ public class PureTLSSocketFactory extends org.apache.tomcat.util.net.ServerSocketFactory { static org.apache.commons.logging.Log logger = - org.apache.commons.logging.LogFactory.getLog(PureTLSSocketFactory.class); + org.apache.commons.logging.LogFactory.getLog(PureTLSSocketFactory.class); static String defaultProtocol = "TLS"; static boolean defaultClientAuth = false; static String defaultKeyStoreFile = "server.pem"; @@ -58,71 +58,71 @@ public class PureTLSSocketFactory } public ServerSocket createSocket(int port) - throws IOException + throws IOException { - init(); - return new SSLServerSocket(context,port); + init(); + return new SSLServerSocket(context,port); } public ServerSocket createSocket(int port, int backlog) - throws IOException + throws IOException { - init(); - ServerSocket tmp; - - try { - tmp=new SSLServerSocket(context,port,backlog); - } - catch (IOException e){ - throw e; - } - return tmp; + init(); + ServerSocket tmp; + + try { + tmp=new SSLServerSocket(context,port,backlog); + } + catch (IOException e){ + throw e; + } + return tmp; } public ServerSocket createSocket(int port, int backlog, - InetAddress ifAddress) - throws IOException + InetAddress ifAddress) + throws IOException { - init(); - return new SSLServerSocket(context,port,backlog,ifAddress); + init(); + return new SSLServerSocket(context,port,backlog,ifAddress); } private void init() - throws IOException + throws IOException { - if(context!=null) - return; - - boolean clientAuth=defaultClientAuth; - - try { - String keyStoreFile=(String)attributes.get("keystore"); - if(keyStoreFile==null) keyStoreFile=defaultKeyStoreFile; - - String keyPass=(String)attributes.get("keypass"); - if(keyPass==null) keyPass=defaultKeyPass; - - String rootFile=(String)attributes.get("rootfile"); - if(rootFile==null) rootFile=defaultRootFile; - - String randomFile=(String)attributes.get("randomfile"); - if(randomFile==null) randomFile=defaultRandomFile; - - String protocol=(String)attributes.get("protocol"); - if(protocol==null) protocol=defaultProtocol; - - String clientAuthStr=(String)attributes.get("clientauth"); - if(clientAuthStr != null){ - if(clientAuthStr.equals("true")){ - clientAuth=true; - } else if(clientAuthStr.equals("false")) { - clientAuth=false; - } else { - throw new IOException("Invalid value '" + - clientAuthStr + - "' for 'clientauth' parameter:"); - } - } + if(context!=null) + return; + + boolean clientAuth=defaultClientAuth; + + try { + String keyStoreFile=(String)attributes.get("keystore"); + if(keyStoreFile==null) keyStoreFile=defaultKeyStoreFile; + + String keyPass=(String)attributes.get("keypass"); + if(keyPass==null) keyPass=defaultKeyPass; + + String rootFile=(String)attributes.get("rootfile"); + if(rootFile==null) rootFile=defaultRootFile; + + String randomFile=(String)attributes.get("randomfile"); + if(randomFile==null) randomFile=defaultRandomFile; + + String protocol=(String)attributes.get("protocol"); + if(protocol==null) protocol=defaultProtocol; + + String clientAuthStr=(String)attributes.get("clientauth"); + if(clientAuthStr != null){ + if(clientAuthStr.equals("true")){ + clientAuth=true; + } else if(clientAuthStr.equals("false")) { + clientAuth=false; + } else { + throw new IOException("Invalid value '" + + clientAuthStr + + "' for 'clientauth' parameter:"); + } + } SSLContext tmpContext=new SSLContext(); try { @@ -133,10 +133,10 @@ public class PureTLSSocketFactory rootFile,iex); } tmpContext.loadEAYKeyFile(keyStoreFile,keyPass); - tmpContext.useRandomnessFile(randomFile,keyPass); - - SSLPolicyInt policy=new SSLPolicyInt(); - policy.requireClientAuth(clientAuth); + tmpContext.useRandomnessFile(randomFile,keyPass); + + SSLPolicyInt policy=new SSLPolicyInt(); + policy.requireClientAuth(clientAuth); policy.handshakeOnConnect(false); policy.waitOnClose(false); short [] enabledCiphers = getEnabledCiphers(policy.getCipherSuites()); @@ -144,11 +144,11 @@ public class PureTLSSocketFactory policy.setCipherSuites(enabledCiphers); } tmpContext.setPolicy(policy); - context=tmpContext; - } catch (Exception e){ - logger.info("Error initializing SocketFactory",e); - throw new IOException(e.getMessage()); - } + context=tmpContext; + } catch (Exception e){ + logger.info("Error initializing SocketFactory",e); + throw new IOException(e.getMessage()); + } } /* @@ -206,21 +206,21 @@ public class PureTLSSocketFactory } public Socket acceptSocket(ServerSocket socket) - throws IOException + throws IOException { - try { - Socket sock=socket.accept(); - return sock; - } catch (SSLException e){ + try { + Socket sock=socket.accept(); + return sock; + } catch (SSLException e){ logger.debug("SSL handshake error",e); throw new SocketException("SSL handshake error" + e.toString()); - } + } } public void handshake(Socket sock) - throws IOException + throws IOException { - ((SSLSocket)sock).handshake(); + ((SSLSocket)sock).handshake(); } } diff --git a/java/org/apache/tomcat/util/net/puretls/PureTLSSupport.java b/java/org/apache/tomcat/util/net/puretls/PureTLSSupport.java index 52a5129e0..e2e7c456d 100644 --- a/java/org/apache/tomcat/util/net/puretls/PureTLSSupport.java +++ b/java/org/apache/tomcat/util/net/puretls/PureTLSSupport.java @@ -44,7 +44,7 @@ import COM.claymoresystems.sslg.SSLPolicyInt; class PureTLSSupport implements SSLSupport { static org.apache.commons.logging.Log logger = - org.apache.commons.logging.LogFactory.getLog(PureTLSSupport.class); + org.apache.commons.logging.LogFactory.getLog(PureTLSSupport.class); private COM.claymoresystems.ptls.SSLSocket ssl; @@ -59,21 +59,21 @@ class PureTLSSupport implements SSLSupport { public Object[] getPeerCertificateChain() throws IOException { - return getPeerCertificateChain(false); + return getPeerCertificateChain(false); } public Object[] getPeerCertificateChain(boolean force) throws IOException { Vector v=ssl.getCertificateChain(); - if(v == null && force) { - SSLPolicyInt policy=new SSLPolicyInt(); - policy.requireClientAuth(true); - policy.handshakeOnConnect(false); - policy.waitOnClose(false); - ssl.renegotiate(policy); - v = ssl.getCertificateChain(); - } + if(v == null && force) { + SSLPolicyInt policy=new SSLPolicyInt(); + policy.requireClientAuth(true); + policy.handshakeOnConnect(false); + policy.waitOnClose(false); + ssl.renegotiate(policy); + v = ssl.getCertificateChain(); + } if(v==null) return null; @@ -97,11 +97,11 @@ class PureTLSSupport implements SSLSupport { X509Certificate xCert = (X509Certificate)cf.generateCertificate(stream); chain[i-1]= xCert; if(logger.isTraceEnabled()) { - logger.trace("Cert # " + i + " = " + xCert); - } + logger.trace("Cert # " + i + " = " + xCert); + } } } catch (java.security.cert.CertificateException e) { - logger.info("JDK's broken cert handling can't parse this certificate (which PureTLS likes)",e); + logger.info("JDK's broken cert handling can't parse this certificate (which PureTLS likes)",e); throw new IOException("JDK's broken cert handling can't parse this certificate (which PureTLS likes)"); } return chain; -- 2.11.0