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
4744 /**
@@ -51,9 +48,8 @@ public class BasicSSLSessionInfo implements SSLSessionInfo {
5148 * @param certificate A string representation of the client certificate
5249 * @param keySize The key-size used by the cypher
5350 * @throws java.security.cert.CertificateException If the client cert could not be decoded
54- * @throws CertificateException If the client cert could not be decoded
5551 */
56- public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate , Integer keySize ) throws java .security .cert .CertificateException , CertificateException {
52+ public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate , Integer keySize ) throws java .security .cert .CertificateException {
5753 this .sessionId = sessionId ;
5854 this .cypherSuite = cypherSuite ;
5955 this .keySize = keySize ;
@@ -63,26 +59,13 @@ public BasicSSLSessionInfo(byte[] sessionId, String cypherSuite, String certific
6359 ByteArrayInputStream stream = new ByteArrayInputStream (certificateBytes );
6460 Collection <? extends java .security .cert .Certificate > certCol = cf .generateCertificates (stream );
6561 this .peerCertificate = new java .security .cert .Certificate [certCol .size ()];
66- X509Certificate [] legacyCertificate = new X509Certificate [certCol .size ()];
6762 int i =0 ;
6863 for (java .security .cert .Certificate cert : certCol ) {
6964 this .peerCertificate [i ] = cert ;
70- if (legacyCertificate != null ) {
71- try {
72- legacyCertificate [i ] = X509Certificate .getInstance (cert .getEncoded ());
73- } catch (CertificateException ce ) {
74- // [UNDERTOW-1969] We don't care about deprecated JDK methods failure caused by the fact newer JDKs
75- // doesn't support them anymore. "this.certificate" is used only by deprecated method
76- // {@link SSLSessionInfo.getPeerCertificateChain()} which call should be avoided by API users.
77- legacyCertificate = null ;
78- }
79- }
8065 i ++;
8166 }
82- this .certificate = legacyCertificate ;
8367 } else {
8468 this .peerCertificate = null ;
85- this .certificate = null ;
8669 }
8770 }
8871
@@ -92,9 +75,8 @@ public BasicSSLSessionInfo(byte[] sessionId, String cypherSuite, String certific
9275 * @param cypherSuite The cypher suite name
9376 * @param certificate A string representation of the client certificate
9477 * @throws java.security.cert.CertificateException If the client cert could not be decoded
95- * @throws CertificateException If the client cert could not be decoded
9678 */
97- public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate ) throws java .security .cert .CertificateException , CertificateException {
79+ public BasicSSLSessionInfo (byte [] sessionId , String cypherSuite , String certificate ) throws java .security .cert .CertificateException {
9880 this (sessionId , cypherSuite , certificate , null );
9981 }
10082
@@ -104,9 +86,8 @@ public BasicSSLSessionInfo(byte[] sessionId, String cypherSuite, String certific
10486 * @param cypherSuite The cypher suite name
10587 * @param certificate A string representation of the client certificate
10688 * @throws java.security.cert.CertificateException If the client cert could not be decoded
107- * @throws CertificateException If the client cert could not be decoded
10889 */
109- public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate ) throws java .security .cert .CertificateException , CertificateException {
90+ public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate ) throws java .security .cert .CertificateException {
11091 this (sessionId == null ? null : fromHex (sessionId ), cypherSuite , certificate , null );
11192 }
11293
@@ -117,9 +98,8 @@ public BasicSSLSessionInfo(String sessionId, String cypherSuite, String certific
11798 * @param certificate A string representation of the client certificate
11899 * @param keySize The key-size used by the cypher
119100 * @throws java.security.cert.CertificateException If the client cert could not be decoded
120- * @throws CertificateException If the client cert could not be decoded
121101 */
122- public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate , Integer keySize ) throws java .security .cert .CertificateException , CertificateException {
102+ public BasicSSLSessionInfo (String sessionId , String cypherSuite , String certificate , Integer keySize ) throws java .security .cert .CertificateException {
123103 this (sessionId == null ? null : fromHex (sessionId ), cypherSuite , certificate , keySize );
124104 }
125105
@@ -155,15 +135,6 @@ public java.security.cert.Certificate[] getPeerCertificates() throws SSLPeerUnve
155135 return peerCertificate ;
156136 }
157137
158- @ Deprecated
159- @ Override
160- public X509Certificate [] getPeerCertificateChain () throws SSLPeerUnverifiedException {
161- if (certificate == null ) {
162- throw UndertowMessages .MESSAGES .peerUnverified ();
163- }
164- return certificate ;
165- }
166-
167138 @ Override
168139 public void renegotiate (HttpServerExchange exchange , SslClientAuthMode sslClientAuthMode ) throws IOException {
169140 throw UndertowMessages .MESSAGES .renegotiationNotSupported ();
0 commit comments