1 /*
2 * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
204 /**
205 * Returns the cipher suite in use on this connection.
206 */
207 public String getCipherSuite () {
208 if (cachedResponse != null) {
209 return ((SecureCacheResponse)cachedResponse).getCipherSuite();
210 }
211 if (http == null) {
212 throw new IllegalStateException("connection not yet open");
213 } else {
214 return ((HttpsClient)http).getCipherSuite ();
215 }
216 }
217
218 /**
219 * Returns the certificate chain the client sent to the
220 * server, or null if the client did not authenticate.
221 */
222 public java.security.cert.Certificate[] getLocalCertificates() {
223 if (cachedResponse != null) {
224 List l = ((SecureCacheResponse)cachedResponse).getLocalCertificateChain();
225 if (l == null) {
226 return null;
227 } else {
228 return (java.security.cert.Certificate[])l.toArray();
229 }
230 }
231 if (http == null) {
232 throw new IllegalStateException("connection not yet open");
233 } else {
234 return (((HttpsClient)http).getLocalCertificates ());
235 }
236 }
237
238 /**
239 * Returns the server's certificate chain, or throws
240 * SSLPeerUnverified Exception if
241 * the server did not authenticate.
242 */
243 public java.security.cert.Certificate[] getServerCertificates()
244 throws SSLPeerUnverifiedException {
245 if (cachedResponse != null) {
246 List l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain();
247 if (l == null) {
248 return null;
249 } else {
250 return (java.security.cert.Certificate[])l.toArray();
251 }
252 }
253
254 if (http == null) {
255 throw new IllegalStateException("connection not yet open");
256 } else {
257 return (((HttpsClient)http).getServerCertificates ());
258 }
259 }
260
261 /**
262 * Returns the server's X.509 certificate chain, or null if
263 * the server did not authenticate.
264 */
265 public javax.security.cert.X509Certificate[] getServerCertificateChain()
266 throws SSLPeerUnverifiedException {
267 if (cachedResponse != null) {
268 throw new UnsupportedOperationException("this method is not supported when using cache");
269 }
270 if (http == null) {
|
1 /*
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
204 /**
205 * Returns the cipher suite in use on this connection.
206 */
207 public String getCipherSuite () {
208 if (cachedResponse != null) {
209 return ((SecureCacheResponse)cachedResponse).getCipherSuite();
210 }
211 if (http == null) {
212 throw new IllegalStateException("connection not yet open");
213 } else {
214 return ((HttpsClient)http).getCipherSuite ();
215 }
216 }
217
218 /**
219 * Returns the certificate chain the client sent to the
220 * server, or null if the client did not authenticate.
221 */
222 public java.security.cert.Certificate[] getLocalCertificates() {
223 if (cachedResponse != null) {
224 List<java.security.cert.Certificate> l = ((SecureCacheResponse)cachedResponse).getLocalCertificateChain();
225 if (l == null) {
226 return null;
227 } else {
228 return l.toArray(new java.security.cert.Certificate[0]);
229 }
230 }
231 if (http == null) {
232 throw new IllegalStateException("connection not yet open");
233 } else {
234 return (((HttpsClient)http).getLocalCertificates ());
235 }
236 }
237
238 /**
239 * Returns the server's certificate chain, or throws
240 * SSLPeerUnverified Exception if
241 * the server did not authenticate.
242 */
243 public java.security.cert.Certificate[] getServerCertificates()
244 throws SSLPeerUnverifiedException {
245 if (cachedResponse != null) {
246 List<java.security.cert.Certificate> l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain();
247 if (l == null) {
248 return null;
249 } else {
250 return l.toArray(new java.security.cert.Certificate[0]);
251 }
252 }
253
254 if (http == null) {
255 throw new IllegalStateException("connection not yet open");
256 } else {
257 return (((HttpsClient)http).getServerCertificates ());
258 }
259 }
260
261 /**
262 * Returns the server's X.509 certificate chain, or null if
263 * the server did not authenticate.
264 */
265 public javax.security.cert.X509Certificate[] getServerCertificateChain()
266 throws SSLPeerUnverifiedException {
267 if (cachedResponse != null) {
268 throw new UnsupportedOperationException("this method is not supported when using cache");
269 }
270 if (http == null) {
|