tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Warner Onstine" <onst...@intalio.com>
Subject [patch] Patch for SSL
Date Sat, 01 Jul 2000 19:28:43 GMT
Hi all,
I have added some variables and cleaned up some stuff in Costin's code.  It
has been now set up for Client Auth.

--------------------------------------------------
Index: SSLSocketFactory.java

===================================================================

RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/net/SSLSocketFact
ory.java,v

retrieving revision 1.1

diff -r1.1 SSLSocketFactory.java

96a97

> private String keystore;

102a104,107

> static String defaultKeystore = "JKS";

> static String defaultProtocol = "TLS";

> static String defaultAlgorithm = "SunX509";

> static boolean defaultClientAuth = false;

151c156,157

< String keystoreFile=(String)attributes.get("keystore");

---

> //Where is the server certificate at?

> String keystoreFile=(String)attributes.get("keystoreFile");

153a160

> //Password for the server certificate

156a164,186

> //This is the type of keystore ie - JKS

> keystore = (String)attributes.get("keystore");

> if(keystore == null) keystore=defaultKeystore;

>

> //determine whether we want client authentication

> String clientAuthBool = (String)attributes.get("clientauth");

>

>
clientAuthBool==null){ 

> clientAuth=defaultClientAuth;

> } else if(clientAuthBool.equalsIgnoreCase("true")){

> clientAuth = true;

> } else{

> clientAuth = false;

> }

> 

> //protocol for the SSL ie - TLS, SSL v3 etc.

> String protocol = (String)attributes.get("protocol");

> if(protocol == null) protocol = defaultProtocol;

> 

> //Algorithm used to encode the certificate ie - SunX509

> String algorithm = (String)attributes.get("algorithm");

> if(algorithm == null) algorithm = defaultAlgorithm;

> 

164c194

< com.sun.net.ssl.SSLContext.getInstance("TLS"); //SSL

---

> com.sun.net.ssl.SSLContext.getInstance(protocol); //SSL

168c198

< com.sun.net.ssl.KeyManagerFactory.getInstance("SunX509");

---

> com.sun.net.ssl.KeyManagerFactory.getInstance(algo
rithm);

177c207

< context.init(kmf.getKeyManagers(), null, null);

---

> context.init(kmf.getKeyManagers(), null, new
java.security.SecureRandom());

203c233

< socket.setNeedClientAuth(false);

---

> socket.setNeedClientAuth(clientAuth);

212c242

< KeyStore kstore=KeyStore.getInstance( "JKS" );

---

> KeyStore kstore=KeyStore.getInstance(keystore);



Mime
View raw message