00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 package org.objectweb.cjdbc.common.net;
00026
00027 import java.io.File;
00028 import java.io.Serializable;
00029
00030
00031
00032
00033
00034
00035
00036 public class SSLConfiguration implements Serializable
00037 {
00038
00039 private File keyStore;
00040
00041 private String keyStorePassword;
00042
00043 private String keyStoreKeyPassword;
00044
00045
00046
00047
00048 private boolean isClientAuthenticationRequired = false;
00049
00050
00051 private File trustStore;
00052
00053 private String trustStorePassword;
00054
00055
00056
00057
00058
00059
00060 public boolean isClientAuthenticationRequired()
00061 {
00062 return isClientAuthenticationRequired;
00063 }
00064
00065
00066
00067
00068
00069
00070
00071 public void setClientAuthenticationRequired(
00072 boolean isClientAuthenticationRequired)
00073 {
00074 this.isClientAuthenticationRequired = isClientAuthenticationRequired;
00075 }
00076
00077
00078
00079
00080
00081
00082 public File getKeyStore()
00083 {
00084 return keyStore;
00085 }
00086
00087
00088
00089
00090
00091
00092 public void setKeyStore(File keyStore)
00093 {
00094 this.keyStore = keyStore;
00095 }
00096
00097
00098
00099
00100
00101
00102 public String getKeyStoreKeyPassword()
00103 {
00104 if (keyStoreKeyPassword != null)
00105 return keyStoreKeyPassword;
00106 return getKeyStorePassword();
00107 }
00108
00109
00110
00111
00112
00113
00114 public void setKeyStoreKeyPassword(String keyStoreKeyPassword)
00115 {
00116 this.keyStoreKeyPassword = keyStoreKeyPassword;
00117 }
00118
00119
00120
00121
00122
00123
00124 public String getKeyStorePassword()
00125 {
00126 return keyStorePassword;
00127 }
00128
00129
00130
00131
00132
00133
00134 public void setKeyStorePassword(String keyStorePassword)
00135 {
00136 this.keyStorePassword = keyStorePassword;
00137 }
00138
00139
00140
00141
00142
00143
00144 public File getTrustStore()
00145 {
00146 if (trustStore != null)
00147 return trustStore;
00148
00149 return getKeyStore();
00150 }
00151
00152
00153
00154
00155
00156
00157 public void setTrustStore(File trustStore)
00158 {
00159 this.trustStore = trustStore;
00160 }
00161
00162
00163
00164
00165
00166
00167 public String getTrustStorePassword()
00168 {
00169 if (trustStorePassword != null)
00170 return trustStorePassword;
00171
00172 return getKeyStorePassword();
00173 }
00174
00175
00176
00177
00178
00179
00180 public void setTrustStorePassword(String trustStorePassword)
00181 {
00182 this.trustStorePassword = trustStorePassword;
00183 }
00184
00185
00186
00187
00188
00189
00190
00191 public static SSLConfiguration getDefaultConfig()
00192 {
00193 SSLConfiguration config = new SSLConfiguration();
00194 config.keyStore = new File(System.getProperty("javax.net.ssl.keyStore"));
00195 config.keyStorePassword = System
00196 .getProperty("javax.net.ssl.keyStorePassword");
00197 config.keyStoreKeyPassword = System
00198 .getProperty("javax.net.ssl.keyStorePassword");
00199 config.trustStore = new File(System.getProperty("javax.net.ssl.trustStore"));
00200 config.trustStorePassword = System
00201 .getProperty("javax.net.ssl.trustStorePassword");
00202 return config;
00203 }
00204
00205 }