1818 */
1919package org .neo4j .driver .internal .security ;
2020
21- import static org .neo4j .driver .RevocationStrategy .VERIFY_IF_PRESENT ;
22- import static org .neo4j .driver .RevocationStrategy .requiresRevocationChecking ;
21+ import static org .neo4j .driver .RevocationCheckingStrategy .VERIFY_IF_PRESENT ;
22+ import static org .neo4j .driver .RevocationCheckingStrategy .requiresRevocationChecking ;
2323import static org .neo4j .driver .internal .util .CertificateTool .loadX509Cert ;
2424
2525import java .io .File ;
4141import javax .net .ssl .TrustManager ;
4242import javax .net .ssl .TrustManagerFactory ;
4343import javax .net .ssl .X509TrustManager ;
44- import org .neo4j .driver .RevocationStrategy ;
44+ import org .neo4j .driver .RevocationCheckingStrategy ;
4545
4646/**
4747 * A SecurityPlan consists of encryption and trust details.
4848 */
4949public class SecurityPlanImpl implements SecurityPlan {
5050 public static SecurityPlan forAllCertificates (
51- boolean requiresHostnameVerification , RevocationStrategy revocationStrategy )
51+ boolean requiresHostnameVerification , RevocationCheckingStrategy revocationCheckingStrategy )
5252 throws GeneralSecurityException {
5353 SSLContext sslContext = SSLContext .getInstance ("TLS" );
5454 sslContext .init (new KeyManager [0 ], new TrustManager [] {new TrustAllTrustManager ()}, null );
5555
56- return new SecurityPlanImpl (true , sslContext , requiresHostnameVerification , revocationStrategy );
56+ return new SecurityPlanImpl (true , sslContext , requiresHostnameVerification , revocationCheckingStrategy );
5757 }
5858
5959 public static SecurityPlan forCustomCASignedCertificates (
60- List <File > certFiles , boolean requiresHostnameVerification , RevocationStrategy revocationStrategy )
60+ List <File > certFiles ,
61+ boolean requiresHostnameVerification ,
62+ RevocationCheckingStrategy revocationCheckingStrategy )
6163 throws GeneralSecurityException , IOException {
62- SSLContext sslContext = configureSSLContext (certFiles , revocationStrategy );
63- return new SecurityPlanImpl (true , sslContext , requiresHostnameVerification , revocationStrategy );
64+ SSLContext sslContext = configureSSLContext (certFiles , revocationCheckingStrategy );
65+ return new SecurityPlanImpl (true , sslContext , requiresHostnameVerification , revocationCheckingStrategy );
6466 }
6567
6668 public static SecurityPlan forSystemCASignedCertificates (
67- boolean requiresHostnameVerification , RevocationStrategy revocationStrategy )
69+ boolean requiresHostnameVerification , RevocationCheckingStrategy revocationCheckingStrategy )
6870 throws GeneralSecurityException , IOException {
69- SSLContext sslContext = configureSSLContext (Collections .emptyList (), revocationStrategy );
70- return new SecurityPlanImpl (true , sslContext , requiresHostnameVerification , revocationStrategy );
71+ SSLContext sslContext = configureSSLContext (Collections .emptyList (), revocationCheckingStrategy );
72+ return new SecurityPlanImpl (true , sslContext , requiresHostnameVerification , revocationCheckingStrategy );
7173 }
7274
73- private static SSLContext configureSSLContext (List <File > customCertFiles , RevocationStrategy revocationStrategy )
75+ private static SSLContext configureSSLContext (
76+ List <File > customCertFiles , RevocationCheckingStrategy revocationCheckingStrategy )
7477 throws GeneralSecurityException , IOException {
7578 KeyStore trustedKeyStore = KeyStore .getInstance (KeyStore .getDefaultType ());
7679 trustedKeyStore .load (null , null );
@@ -83,7 +86,7 @@ private static SSLContext configureSSLContext(List<File> customCertFiles, Revoca
8386 }
8487
8588 PKIXBuilderParameters pkixBuilderParameters =
86- configurePKIXBuilderParameters (trustedKeyStore , revocationStrategy );
89+ configurePKIXBuilderParameters (trustedKeyStore , revocationCheckingStrategy );
8790
8891 SSLContext sslContext = SSLContext .getInstance ("TLS" );
8992 TrustManagerFactory trustManagerFactory =
@@ -101,11 +104,11 @@ private static SSLContext configureSSLContext(List<File> customCertFiles, Revoca
101104 }
102105
103106 private static PKIXBuilderParameters configurePKIXBuilderParameters (
104- KeyStore trustedKeyStore , RevocationStrategy revocationStrategy )
107+ KeyStore trustedKeyStore , RevocationCheckingStrategy revocationCheckingStrategy )
105108 throws InvalidAlgorithmParameterException , KeyStoreException {
106109 PKIXBuilderParameters pkixBuilderParameters = null ;
107110
108- if (requiresRevocationChecking (revocationStrategy )) {
111+ if (requiresRevocationChecking (revocationCheckingStrategy )) {
109112 // Configure certificate revocation checking (X509CertSelector() selects all certificates)
110113 pkixBuilderParameters = new PKIXBuilderParameters (trustedKeyStore , new X509CertSelector ());
111114
@@ -115,7 +118,7 @@ private static PKIXBuilderParameters configurePKIXBuilderParameters(
115118 // enables status_request extension in client hello
116119 System .setProperty ("jdk.tls.client.enableStatusRequestExtension" , "true" );
117120
118- if (revocationStrategy .equals (VERIFY_IF_PRESENT )) {
121+ if (revocationCheckingStrategy .equals (VERIFY_IF_PRESENT )) {
119122 // enables soft-fail behaviour if no stapled response found.
120123 Security .setProperty ("ocsp.enable" , "true" );
121124 }
@@ -146,23 +149,23 @@ private static void loadSystemCertificates(KeyStore trustedKeyStore) throws Gene
146149 }
147150
148151 public static SecurityPlan insecure () {
149- return new SecurityPlanImpl (false , null , false , RevocationStrategy .NO_CHECKS );
152+ return new SecurityPlanImpl (false , null , false , RevocationCheckingStrategy .NO_CHECKS );
150153 }
151154
152155 private final boolean requiresEncryption ;
153156 private final SSLContext sslContext ;
154157 private final boolean requiresHostnameVerification ;
155- private final RevocationStrategy revocationStrategy ;
158+ private final RevocationCheckingStrategy revocationCheckingStrategy ;
156159
157160 private SecurityPlanImpl (
158161 boolean requiresEncryption ,
159162 SSLContext sslContext ,
160163 boolean requiresHostnameVerification ,
161- RevocationStrategy revocationStrategy ) {
164+ RevocationCheckingStrategy revocationCheckingStrategy ) {
162165 this .requiresEncryption = requiresEncryption ;
163166 this .sslContext = sslContext ;
164167 this .requiresHostnameVerification = requiresHostnameVerification ;
165- this .revocationStrategy = revocationStrategy ;
168+ this .revocationCheckingStrategy = revocationCheckingStrategy ;
166169 }
167170
168171 @ Override
@@ -181,8 +184,8 @@ public boolean requiresHostnameVerification() {
181184 }
182185
183186 @ Override
184- public RevocationStrategy revocationStrategy () {
185- return revocationStrategy ;
187+ public RevocationCheckingStrategy revocationCheckingStrategy () {
188+ return revocationCheckingStrategy ;
186189 }
187190
188191 private static class TrustAllTrustManager implements X509TrustManager {
0 commit comments