01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.impl.wsdl.submit.transports.http;
14:
15: import java.security.Principal;
16: import java.security.cert.Certificate;
17:
18: import javax.net.ssl.SSLPeerUnverifiedException;
19: import javax.net.ssl.SSLSession;
20: import javax.net.ssl.SSLSocket;
21:
22: /**
23: * Holder for SSL-Related details for a request/response interchange
24: *
25: * @author ole.matzura
26: */
27:
28: public class SSLInfo {
29: private String cipherSuite;
30: private Principal localPrincipal;
31: private Certificate[] localCertificates;
32: private Principal peerPrincipal;
33: private Certificate[] peerCertificates;
34: private boolean peerUnverified;
35:
36: public SSLInfo(SSLSocket socket) {
37: SSLSession session = socket.getSession();
38:
39: cipherSuite = session.getCipherSuite();
40: localPrincipal = session.getLocalPrincipal();
41: localCertificates = session.getLocalCertificates();
42: try {
43: peerPrincipal = session.getPeerPrincipal();
44: peerCertificates = session.getPeerCertificates();
45: } catch (SSLPeerUnverifiedException e) {
46: peerUnverified = true;
47: }
48: }
49:
50: public String getCipherSuite() {
51: return cipherSuite;
52: }
53:
54: public Certificate[] getLocalCertificates() {
55: return localCertificates;
56: }
57:
58: public Principal getLocalPrincipal() {
59: return localPrincipal;
60: }
61:
62: public Certificate[] getPeerCertificates() {
63: return peerCertificates;
64: }
65:
66: public Principal getPeerPrincipal() {
67: return peerPrincipal;
68: }
69:
70: public boolean isPeerUnverified() {
71: return peerUnverified;
72: }
73: }
|