Mercurial Hosting > luan
annotate src/org/eclipse/jetty/server/ssl/SslCertificates.java @ 963:4b6216fa9cec
replace SelectChannelEndPoint._state with isDispatched
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 14 Oct 2016 00:15:28 -0600 |
parents | 1c0b6841cd32 |
children | 4dc1e1a18661 |
rev | line source |
---|---|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
1 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
2 // ======================================================================== |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
4 // ------------------------------------------------------------------------ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
5 // All rights reserved. This program and the accompanying materials |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
6 // are made available under the terms of the Eclipse Public License v1.0 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
7 // and Apache License v2.0 which accompanies this distribution. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
8 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
9 // The Eclipse Public License is available at |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
10 // http://www.eclipse.org/legal/epl-v10.html |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
11 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
12 // The Apache License v2.0 is available at |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
13 // http://www.opensource.org/licenses/apache2.0.php |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
14 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
15 // You may elect to redistribute this code under either of these licenses. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
16 // ======================================================================== |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
17 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
18 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
19 package org.eclipse.jetty.server.ssl; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
20 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
21 import java.io.ByteArrayInputStream; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
22 import java.io.IOException; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
23 import java.security.cert.X509Certificate; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
24 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
25 import javax.net.ssl.SSLPeerUnverifiedException; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
26 import javax.net.ssl.SSLSession; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
27 import javax.net.ssl.SSLSocket; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
28 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
29 import org.eclipse.jetty.http.HttpSchemes; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
30 import org.eclipse.jetty.io.EndPoint; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
31 import org.eclipse.jetty.server.Request; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
32 import org.eclipse.jetty.util.TypeUtil; |
820
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
33 import org.slf4j.Logger; |
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
34 import org.slf4j.LoggerFactory; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
35 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
36 public class SslCertificates |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
37 { |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
38 private static final Logger LOG = LoggerFactory.getLogger(SslCertificates.class); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
39 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
40 /** |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
41 * The name of the SSLSession attribute that will contain any cached information. |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
42 */ |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
43 static final String CACHED_INFO_ATTR = CachedInfo.class.getName(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
44 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
45 public static X509Certificate[] getCertChain(SSLSession sslSession) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
46 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
47 try |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
48 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
49 javax.security.cert.X509Certificate javaxCerts[]=sslSession.getPeerCertificateChain(); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
50 if (javaxCerts==null||javaxCerts.length==0) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
51 return null; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
52 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
53 int length=javaxCerts.length; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
54 X509Certificate[] javaCerts=new X509Certificate[length]; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
55 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
56 java.security.cert.CertificateFactory cf=java.security.cert.CertificateFactory.getInstance("X.509"); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
57 for (int i=0; i<length; i++) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
58 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
59 byte bytes[]=javaxCerts[i].getEncoded(); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
60 ByteArrayInputStream stream=new ByteArrayInputStream(bytes); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
61 javaCerts[i]=(X509Certificate)cf.generateCertificate(stream); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
62 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
63 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
64 return javaCerts; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
65 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
66 catch (SSLPeerUnverifiedException pue) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
67 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
68 return null; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
69 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
70 catch (Exception e) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
71 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
72 LOG.warn("EXCEPTION",e); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
73 return null; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
74 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
75 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
76 |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
77 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
78 /* ------------------------------------------------------------ */ |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
79 /** |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
80 * Allow the Listener a chance to customise the request. before the server |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
81 * does its stuff. <br> |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
82 * This allows the required attributes to be set for SSL requests. <br> |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
83 * The requirements of the Servlet specs are: |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
84 * <ul> |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
85 * <li> an attribute named "javax.servlet.request.ssl_session_id" of type |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
86 * String (since Servlet Spec 3.0).</li> |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
87 * <li> an attribute named "javax.servlet.request.cipher_suite" of type |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
88 * String.</li> |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
89 * <li> an attribute named "javax.servlet.request.key_size" of type Integer.</li> |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
90 * <li> an attribute named "javax.servlet.request.X509Certificate" of type |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
91 * java.security.cert.X509Certificate[]. This is an array of objects of type |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
92 * X509Certificate, the order of this array is defined as being in ascending |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
93 * order of trust. The first certificate in the chain is the one set by the |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
94 * client, the next is the one used to authenticate the first, and so on. |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
95 * </li> |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
96 * </ul> |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
97 * |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
98 * @param endpoint |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
99 * The Socket the request arrived on. |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
100 * @param request |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
101 * HttpRequest to be customised. |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
102 */ |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
103 public static void customize(SSLSession sslSession, EndPoint endpoint, Request request) throws IOException |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
104 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
105 request.setScheme(HttpSchemes.HTTPS); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
106 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
107 try |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
108 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
109 String cipherSuite=sslSession.getCipherSuite(); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
110 Integer keySize; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
111 X509Certificate[] certs; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
112 String idStr; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
113 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
114 CachedInfo cachedInfo=(CachedInfo)sslSession.getValue(CACHED_INFO_ATTR); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
115 if (cachedInfo!=null) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
116 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
117 keySize=cachedInfo.getKeySize(); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
118 certs=cachedInfo.getCerts(); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
119 idStr=cachedInfo.getIdStr(); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
120 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
121 else |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
122 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
123 keySize=new Integer(ServletSSL.deduceKeyLength(cipherSuite)); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
124 certs=SslCertificates.getCertChain(sslSession); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
125 byte[] bytes = sslSession.getId(); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
126 idStr = TypeUtil.toHexString(bytes); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
127 cachedInfo=new CachedInfo(keySize,certs,idStr); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
128 sslSession.putValue(CACHED_INFO_ATTR,cachedInfo); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
129 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
130 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
131 if (certs!=null) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
132 request.setAttribute("javax.servlet.request.X509Certificate",certs); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
133 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
134 request.setAttribute("javax.servlet.request.cipher_suite",cipherSuite); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
135 request.setAttribute("javax.servlet.request.key_size",keySize); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
136 request.setAttribute("javax.servlet.request.ssl_session_id", idStr); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
137 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
138 catch (Exception e) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
139 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
140 LOG.warn("EXCEPTION",e); |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
141 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
142 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
143 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
144 /* ------------------------------------------------------------ */ |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
145 /* ------------------------------------------------------------ */ |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
146 /* ------------------------------------------------------------ */ |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
147 /** |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
148 * Simple bundle of information that is cached in the SSLSession. Stores the |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
149 * effective keySize and the client certificate chain. |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
150 */ |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
151 private static class CachedInfo |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
152 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
153 private final X509Certificate[] _certs; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
154 private final Integer _keySize; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
155 private final String _idStr; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
156 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
157 CachedInfo(Integer keySize, X509Certificate[] certs,String idStr) |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
158 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
159 this._keySize=keySize; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
160 this._certs=certs; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
161 this._idStr=idStr; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
162 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
163 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
164 X509Certificate[] getCerts() |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
165 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
166 return _certs; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
167 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
168 |
872
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
169 Integer getKeySize() |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
170 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
171 return _keySize; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
172 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
173 |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
174 String getIdStr() |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
175 { |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
176 return _idStr; |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
177 } |
1c0b6841cd32
remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
178 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
179 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
180 } |