143
144 private static Exception loadException = null;
145
146 static {
147 try {
148 KeyStore ks = KeyStore.getInstance("JKS");
149 KeyStore ts = KeyStore.getInstance("JKS");
150
151 char[] passphrase = "passphrase".toCharArray();
152
153 ks.load(new FileInputStream(keyFilename), passphrase);
154 ts.load(new FileInputStream(trustFilename), passphrase);
155
156 KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
157 kmf.init(ks, passphrase);
158
159 TrustManagerFactory tmf =
160 TrustManagerFactory.getInstance("SunX509");
161 tmf.init(ts);
162
163 SSLContext sslCtx = SSLContext.getInstance("TLS");
164 sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
165 sslc = sslCtx;
166 } catch (Exception e) {
167 loadException = e;
168 }
169 }
170
171 /*
172 * Main entry point for this test.
173 */
174 public static void main(String args[]) throws Exception {
175 if (debug) {
176 System.setProperty("javax.net.debug", "all");
177 }
178
179 if (loadException != null) {
180 throw loadException;
181 }
182
183 // Prime the session cache with a good session
|
143
144 private static Exception loadException = null;
145
146 static {
147 try {
148 KeyStore ks = KeyStore.getInstance("JKS");
149 KeyStore ts = KeyStore.getInstance("JKS");
150
151 char[] passphrase = "passphrase".toCharArray();
152
153 ks.load(new FileInputStream(keyFilename), passphrase);
154 ts.load(new FileInputStream(trustFilename), passphrase);
155
156 KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
157 kmf.init(ks, passphrase);
158
159 TrustManagerFactory tmf =
160 TrustManagerFactory.getInstance("SunX509");
161 tmf.init(ts);
162
163 SSLContext sslCtx = SSLContext.getInstance("TLSv1.2");
164 sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
165 sslc = sslCtx;
166 } catch (Exception e) {
167 loadException = e;
168 }
169 }
170
171 /*
172 * Main entry point for this test.
173 */
174 public static void main(String args[]) throws Exception {
175 if (debug) {
176 System.setProperty("javax.net.debug", "all");
177 }
178
179 if (loadException != null) {
180 throw loadException;
181 }
182
183 // Prime the session cache with a good session
|