20
20
package quickfix .mina .ssl ;
21
21
22
22
import java .util .Arrays ;
23
+ import java .util .Objects ;
23
24
24
25
/**
25
26
* Groups together SSL related configuration.
@@ -36,58 +37,7 @@ public class SSLConfig {
36
37
private String [] enabledProtocols ;
37
38
private String [] enabledCipherSuites ;
38
39
private boolean needClientAuth ;
39
- private boolean useSNI ;
40
-
41
- @ Override
42
- public boolean equals (Object obj ) {
43
- if (this == obj )
44
- return true ;
45
- if (obj == null )
46
- return false ;
47
- if (getClass () != obj .getClass ())
48
- return false ;
49
- SSLConfig other = (SSLConfig ) obj ;
50
- if (!Arrays .equals (enabledCipherSuites , other .enabledCipherSuites ))
51
- return false ;
52
- if (!Arrays .equals (enabledProtocols , other .enabledProtocols ))
53
- return false ;
54
- if (keyManagerFactoryAlgorithm == null ) {
55
- if (other .keyManagerFactoryAlgorithm != null )
56
- return false ;
57
- } else if (!keyManagerFactoryAlgorithm .equals (other .keyManagerFactoryAlgorithm ))
58
- return false ;
59
- if (keyStoreName == null ) {
60
- if (other .keyStoreName != null )
61
- return false ;
62
- } else if (!keyStoreName .equals (other .keyStoreName ))
63
- return false ;
64
- if (!Arrays .equals (keyStorePassword , other .keyStorePassword ))
65
- return false ;
66
- if (keyStoreType == null ) {
67
- if (other .keyStoreType != null )
68
- return false ;
69
- } else if (!keyStoreType .equals (other .keyStoreType ))
70
- return false ;
71
- if (needClientAuth != other .needClientAuth )
72
- return false ;
73
- if (trustManagerFactoryAlgorithm == null ) {
74
- if (other .trustManagerFactoryAlgorithm != null )
75
- return false ;
76
- } else if (!trustManagerFactoryAlgorithm .equals (other .trustManagerFactoryAlgorithm ))
77
- return false ;
78
- if (trustStoreName == null ) {
79
- if (other .trustStoreName != null )
80
- return false ;
81
- } else if (!trustStoreName .equals (other .trustStoreName ))
82
- return false ;
83
- if (!Arrays .equals (trustStorePassword , other .trustStorePassword ))
84
- return false ;
85
- if (useSNI != other .useSNI )
86
- return false ;
87
- if (trustStoreType == null ) {
88
- return other .trustStoreType == null ;
89
- } else return trustStoreType .equals (other .trustStoreType );
90
- }
40
+ private String endpointIdentificationAlgorithm ;
91
41
92
42
public String [] getEnabledCipherSuites () {
93
43
return enabledCipherSuites ;
@@ -129,31 +79,12 @@ public String getTrustStoreType() {
129
79
return trustStoreType ;
130
80
}
131
81
132
- @ Override
133
- public int hashCode () {
134
- final int prime = 31 ;
135
- int result = 1 ;
136
- result = prime * result + Arrays .hashCode (enabledCipherSuites );
137
- result = prime * result + Arrays .hashCode (enabledProtocols );
138
- result = prime * result + ((keyManagerFactoryAlgorithm == null ) ? 0 : keyManagerFactoryAlgorithm .hashCode ());
139
- result = prime * result + ((keyStoreName == null ) ? 0 : keyStoreName .hashCode ());
140
- result = prime * result + Arrays .hashCode (keyStorePassword );
141
- result = prime * result + ((keyStoreType == null ) ? 0 : keyStoreType .hashCode ());
142
- result = prime * result + (needClientAuth ? 1231 : 1237 );
143
- result = prime * result
144
- + ((trustManagerFactoryAlgorithm == null ) ? 0 : trustManagerFactoryAlgorithm .hashCode ());
145
- result = prime * result + ((trustStoreName == null ) ? 0 : trustStoreName .hashCode ());
146
- result = prime * result + Arrays .hashCode (trustStorePassword );
147
- result = prime * result + ((trustStoreType == null ) ? 0 : trustStoreType .hashCode ());
148
- return result ;
149
- }
150
-
151
82
public boolean isNeedClientAuth () {
152
83
return needClientAuth ;
153
84
}
154
85
155
- public boolean isUseSNI () {
156
- return useSNI ;
86
+ public String getEndpointIdentificationAlgorithm () {
87
+ return endpointIdentificationAlgorithm ;
157
88
}
158
89
159
90
public void setEnabledCipherSuites (String [] enabledCipherSuites ) {
@@ -184,8 +115,8 @@ public void setNeedClientAuth(boolean needClientAuth) {
184
115
this .needClientAuth = needClientAuth ;
185
116
}
186
117
187
- public void setUseSNI ( boolean useSNI ) {
188
- this .useSNI = useSNI ;
118
+ public void setEndpointIdentificationAlgorithm ( String endpointIdentificationAlgorithm ) {
119
+ this .endpointIdentificationAlgorithm = endpointIdentificationAlgorithm ;
189
120
}
190
121
191
122
public void setTrustManagerFactoryAlgorithm (String trustManagerFactoryAlgorithm ) {
@@ -203,4 +134,33 @@ public void setTrustStorePassword(char[] trustStorePassword) {
203
134
public void setTrustStoreType (String trustStoreType ) {
204
135
this .trustStoreType = trustStoreType ;
205
136
}
137
+
138
+ @ Override
139
+ public boolean equals (Object o ) {
140
+ if (this == o ) return true ;
141
+ if (o == null || getClass () != o .getClass ()) return false ;
142
+ SSLConfig sslConfig = (SSLConfig ) o ;
143
+ return needClientAuth == sslConfig .needClientAuth &&
144
+ Objects .equals (keyStoreName , sslConfig .keyStoreName ) &&
145
+ Arrays .equals (keyStorePassword , sslConfig .keyStorePassword ) &&
146
+ Objects .equals (keyManagerFactoryAlgorithm , sslConfig .keyManagerFactoryAlgorithm ) &&
147
+ Objects .equals (keyStoreType , sslConfig .keyStoreType ) &&
148
+ Objects .equals (trustStoreName , sslConfig .trustStoreName ) &&
149
+ Arrays .equals (trustStorePassword , sslConfig .trustStorePassword ) &&
150
+ Objects .equals (trustManagerFactoryAlgorithm , sslConfig .trustManagerFactoryAlgorithm ) &&
151
+ Objects .equals (trustStoreType , sslConfig .trustStoreType ) &&
152
+ Arrays .equals (enabledProtocols , sslConfig .enabledProtocols ) &&
153
+ Arrays .equals (enabledCipherSuites , sslConfig .enabledCipherSuites ) &&
154
+ Objects .equals (endpointIdentificationAlgorithm , sslConfig .endpointIdentificationAlgorithm );
155
+ }
156
+
157
+ @ Override
158
+ public int hashCode () {
159
+ int result = Objects .hash (keyStoreName , keyManagerFactoryAlgorithm , keyStoreType , trustStoreName , trustManagerFactoryAlgorithm , trustStoreType , needClientAuth , endpointIdentificationAlgorithm );
160
+ result = 31 * result + Arrays .hashCode (keyStorePassword );
161
+ result = 31 * result + Arrays .hashCode (trustStorePassword );
162
+ result = 31 * result + Arrays .hashCode (enabledProtocols );
163
+ result = 31 * result + Arrays .hashCode (enabledCipherSuites );
164
+ return result ;
165
+ }
206
166
}
0 commit comments