2424
2525import javax .net .ssl .SSLPeerUnverifiedException ;
2626import javax .net .ssl .SSLSession ;
27- import javax .security .cert .CertificateException ;
28- import javax .security .cert .X509Certificate ;
2927import java .io .ByteArrayInputStream ;
3028import java .io .IOException ;
3129import java .nio .charset .StandardCharsets ;
@@ -41,7 +39,6 @@ public class BasicSSLSessionInfo implements SSLSessionInfo {
4139 private final byte [] sessionId ;
4240 private final String cypherSuite ;
4341 private final java .security .cert .Certificate [] peerCertificate ;
44- private final X509Certificate [] certificate ;
4542 private final Integer keySize ;
4643 private final String secureProtocol ;
4744
@@ -52,9 +49,8 @@ public class BasicSSLSessionInfo implements SSLSessionInfo {
5249 * @param certificate A string representation of the client certificate
5350 * @param keySize The key-size used by the cypher
5451 * @throws java.security.cert.CertificateException If the client cert could not be decoded
55- * @throws CertificateException If the client cert could not be decoded
5652 */
57- public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate , Integer keySize ) throws java .security .cert .CertificateException , CertificateException {
53+ public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate , Integer keySize ) throws java .security .cert .CertificateException {
5854 this (sessionId , cypherSuite , certificate , keySize , null );
5955 }
6056
@@ -66,9 +62,8 @@ public BasicSSLSessionInfo(byte[] sessionId, String cypherSuite, String certific
6662 * @param keySize The key-size used by the cypher
6763 * @param secureProtocol the secure protocol, example {@code TLSv1.2}
6864 * @throws java.security.cert.CertificateException If the client cert could not be decoded
69- * @throws CertificateException If the client cert could not be decoded
7065 */
71- public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate , Integer keySize , String secureProtocol ) throws java .security .cert .CertificateException , CertificateException {
66+ public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate , Integer keySize , String secureProtocol ) throws java .security .cert .CertificateException {
7267 this .sessionId = sessionId ;
7368 this .cypherSuite = cypherSuite ;
7469 this .keySize = keySize ;
@@ -79,26 +74,13 @@ public BasicSSLSessionInfo(byte[] sessionId, String cypherSuite, String certific
7974 ByteArrayInputStream stream = new ByteArrayInputStream (certificateBytes );
8075 Collection <? extends java .security .cert .Certificate > certCol = cf .generateCertificates (stream );
8176 this .peerCertificate = new java .security .cert .Certificate [certCol .size ()];
82- X509Certificate [] legacyCertificate = new X509Certificate [certCol .size ()];
8377 int i =0 ;
8478 for (java .security .cert .Certificate cert : certCol ) {
8579 this .peerCertificate [i ] = cert ;
86- if (legacyCertificate != null ) {
87- try {
88- legacyCertificate [i ] = X509Certificate .getInstance (cert .getEncoded ());
89- } catch (CertificateException ce ) {
90- // [UNDERTOW-1969] We don't care about deprecated JDK methods failure caused by the fact newer JDKs
91- // doesn't support them anymore. "this.certificate" is used only by deprecated method
92- // {@link SSLSessionInfo.getPeerCertificateChain()} which call should be avoided by API users.
93- legacyCertificate = null ;
94- }
95- }
9680 i ++;
9781 }
98- this .certificate = legacyCertificate ;
9982 } else {
10083 this .peerCertificate = null ;
101- this .certificate = null ;
10284 }
10385 }
10486
@@ -108,9 +90,8 @@ public BasicSSLSessionInfo(byte[] sessionId, String cypherSuite, String certific
10890 * @param cypherSuite The cypher suite name
10991 * @param certificate A string representation of the client certificate
11092 * @throws java.security.cert.CertificateException If the client cert could not be decoded
111- * @throws CertificateException If the client cert could not be decoded
11293 */
113- public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate ) throws java .security .cert .CertificateException , CertificateException {
94+ public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate ) throws java .security .cert .CertificateException {
11495 this (sessionId , cypherSuite , certificate , null );
11596 }
11697
@@ -120,9 +101,8 @@ public BasicSSLSessionInfo(byte[] sessionId, String cypherSuite, String certific
120101 * @param cypherSuite The cypher suite name
121102 * @param certificate A string representation of the client certificate
122103 * @throws java.security.cert.CertificateException If the client cert could not be decoded
123- * @throws CertificateException If the client cert could not be decoded
124104 */
125- public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate ) throws java .security .cert .CertificateException , CertificateException {
105+ public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate ) throws java .security .cert .CertificateException {
126106 this (sessionId == null ? null : fromHex (sessionId ), cypherSuite , certificate , null );
127107 }
128108
@@ -133,9 +113,8 @@ public BasicSSLSessionInfo(String sessionId, String cypherSuite, String certific
133113 * @param certificate A string representation of the client certificate
134114 * @param keySize The key-size used by the cypher
135115 * @throws java.security.cert.CertificateException If the client cert could not be decoded
136- * @throws CertificateException If the client cert could not be decoded
137116 */
138- public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate , Integer keySize ) throws java .security .cert .CertificateException , CertificateException {
117+ public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate , Integer keySize ) throws java .security .cert .CertificateException {
139118 this (sessionId == null ? null : fromHex (sessionId ), cypherSuite , certificate , keySize );
140119 }
141120
@@ -147,9 +126,8 @@ public BasicSSLSessionInfo(String sessionId, String cypherSuite, String certific
147126 * @param keySize The key-size used by the cypher
148127 * @param secureProtocol the secure protocol, example {@code TLSv1.2}
149128 * @throws java.security.cert.CertificateException If the client cert could not be decoded
150- * @throws CertificateException If the client cert could not be decoded
151129 */
152- public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate , Integer keySize , String secureProtocol ) throws java .security .cert .CertificateException , CertificateException {
130+ public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate , Integer keySize , String secureProtocol ) throws java .security .cert .CertificateException {
153131 this (sessionId == null ? null : fromHex (sessionId ), cypherSuite , certificate , keySize , secureProtocol );
154132 }
155133
@@ -185,15 +163,6 @@ public java.security.cert.Certificate[] getPeerCertificates() throws SSLPeerUnve
185163 return peerCertificate ;
186164 }
187165
188- @ Deprecated
189- @ Override
190- public X509Certificate [] getPeerCertificateChain () throws SSLPeerUnverifiedException {
191- if (certificate == null ) {
192- throw UndertowMessages .MESSAGES .peerUnverified ();
193- }
194- return certificate ;
195- }
196-
197166 @ Override
198167 public void renegotiate (HttpServerExchange exchange , SslClientAuthMode sslClientAuthMode ) throws IOException {
199168 throw UndertowMessages .MESSAGES .renegotiationNotSupported ();
0 commit comments