annotate src/org/eclipse/jetty/server/ssl/SslCertificates.java @ 1061:c880589715c7

remove JBuffer.setGetIndex()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 08 Nov 2016 05:54:53 -0700
parents 4dc1e1a18661
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.io.EndPoint;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 import org.eclipse.jetty.server.Request;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 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
32 import org.slf4j.Logger;
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
33 import org.slf4j.LoggerFactory;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 public class SslCertificates
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 {
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
37 private static final Logger LOG = LoggerFactory.getLogger(SslCertificates.class);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
39 /**
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
40 * The name of the SSLSession attribute that will contain any cached information.
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
41 */
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
42 static final String CACHED_INFO_ATTR = CachedInfo.class.getName();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
44 public static X509Certificate[] getCertChain(SSLSession sslSession)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
45 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
46 try
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
47 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
48 javax.security.cert.X509Certificate javaxCerts[]=sslSession.getPeerCertificateChain();
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
49 if (javaxCerts==null||javaxCerts.length==0)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
50 return null;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
52 int length=javaxCerts.length;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
53 X509Certificate[] javaCerts=new X509Certificate[length];
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
54
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
55 java.security.cert.CertificateFactory cf=java.security.cert.CertificateFactory.getInstance("X.509");
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
56 for (int i=0; i<length; i++)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
57 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
58 byte bytes[]=javaxCerts[i].getEncoded();
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
59 ByteArrayInputStream stream=new ByteArrayInputStream(bytes);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
60 javaCerts[i]=(X509Certificate)cf.generateCertificate(stream);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
61 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
62
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
63 return javaCerts;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
64 }
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
65 catch (SSLPeerUnverifiedException pue)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
66 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
67 return null;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
68 }
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
69 catch (Exception e)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
70 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
71 LOG.warn("EXCEPTION",e);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
72 return null;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
73 }
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
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
76
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
77 /* ------------------------------------------------------------ */
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 * Allow the Listener a chance to customise the request. before the server
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
80 * does its stuff. <br>
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
81 * This allows the required attributes to be set for SSL requests. <br>
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
82 * The requirements of the Servlet specs are:
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
83 * <ul>
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
84 * <li> an attribute named "javax.servlet.request.ssl_session_id" of type
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
85 * String (since Servlet Spec 3.0).</li>
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
86 * <li> an attribute named "javax.servlet.request.cipher_suite" of type
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
87 * String.</li>
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
88 * <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
89 * <li> an attribute named "javax.servlet.request.X509Certificate" of type
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
90 * java.security.cert.X509Certificate[]. This is an array of objects of type
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
91 * X509Certificate, the order of this array is defined as being in ascending
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
92 * 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
93 * 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
94 * </li>
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
95 * </ul>
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
96 *
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
97 * @param endpoint
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
98 * The Socket the request arrived on.
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
99 * @param request
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
100 * HttpRequest to be customised.
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
101 */
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
102 public static void customize(SSLSession sslSession, EndPoint endpoint, Request request) throws IOException
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
103 {
1018
4dc1e1a18661 remove HttpSchemes
Franklin Schmidt <fschmidt@gmail.com>
parents: 872
diff changeset
104 request.setScheme("https");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
105
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
106 try
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
107 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
108 String cipherSuite=sslSession.getCipherSuite();
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
109 Integer keySize;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
110 X509Certificate[] certs;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
111 String idStr;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
112
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
113 CachedInfo cachedInfo=(CachedInfo)sslSession.getValue(CACHED_INFO_ATTR);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
114 if (cachedInfo!=null)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
115 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
116 keySize=cachedInfo.getKeySize();
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
117 certs=cachedInfo.getCerts();
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
118 idStr=cachedInfo.getIdStr();
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
119 }
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
120 else
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
121 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
122 keySize=new Integer(ServletSSL.deduceKeyLength(cipherSuite));
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
123 certs=SslCertificates.getCertChain(sslSession);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
124 byte[] bytes = sslSession.getId();
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
125 idStr = TypeUtil.toHexString(bytes);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
126 cachedInfo=new CachedInfo(keySize,certs,idStr);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
127 sslSession.putValue(CACHED_INFO_ATTR,cachedInfo);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
128 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
129
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
130 if (certs!=null)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
131 request.setAttribute("javax.servlet.request.X509Certificate",certs);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
132
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
133 request.setAttribute("javax.servlet.request.cipher_suite",cipherSuite);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
134 request.setAttribute("javax.servlet.request.key_size",keySize);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
135 request.setAttribute("javax.servlet.request.ssl_session_id", idStr);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
136 }
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
137 catch (Exception e)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
138 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
139 LOG.warn("EXCEPTION",e);
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
140 }
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
141 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
142
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
143 /* ------------------------------------------------------------ */
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 * Simple bundle of information that is cached in the SSLSession. Stores the
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
148 * effective keySize and the client certificate chain.
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
149 */
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
150 private static class CachedInfo
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
151 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
152 private final X509Certificate[] _certs;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
153 private final Integer _keySize;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
154 private final String _idStr;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
155
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
156 CachedInfo(Integer keySize, X509Certificate[] certs,String idStr)
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
157 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
158 this._keySize=keySize;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
159 this._certs=certs;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
160 this._idStr=idStr;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
161 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
162
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
163 X509Certificate[] getCerts()
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
164 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
165 return _certs;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
166 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
167
872
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
168 Integer getKeySize()
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
169 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
170 return _keySize;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
171 }
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 String getIdStr()
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
174 {
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
175 return _idStr;
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
176 }
1c0b6841cd32 remove SocketEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
177 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
178
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
179 }