< prev index next >

test/jdk/java/security/cert/CertPathValidator/OCSP/OCSPTimeout.java

Print this page

171         addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
172         addCommonCAExts(cbld);
173         // Make our Root CA Cert!
174         rootCert = cbld.build(null, rootCaKP.getPrivate(),
175                 "SHA256withECDSA");
176         log("Root CA Created:\n%s", certInfo(rootCert));
177 
178         // Now build a keystore and add the keys and cert
179         rootKeystore = keyStoreBuilder.getKeyStore();
180         Certificate[] rootChain = {rootCert};
181         rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
182                 passwd.toCharArray(), rootChain);
183 
184         // Now fire up the OCSP responder
185         rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
186         rootOcsp.enableLog(debug);
187         rootOcsp.setNextUpdateInterval(3600);
188         rootOcsp.setDisableContentLength(true);
189         rootOcsp.start();
190 
191         // Wait 5 seconds for server ready
192         boolean readyStatus = rootOcsp.awaitServerReady(60, TimeUnit.SECONDS);
193         if (!readyStatus) {
194             throw new RuntimeException("Server not ready");
195         }
196 
197         rootOcspPort = rootOcsp.getPort();
198         String rootRespURI = "http://localhost:" + rootOcspPort;
199         log("Root OCSP Responder URI is %s", rootRespURI);
200 
201         // Now that we have the root keystore and OCSP responder we can
202         // create our end entity certificate
203         cbld.reset();
204         cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
205         cbld.setPublicKey(eeKP.getPublic());
206         cbld.setSerialNumber(new BigInteger("4096"));
207         // Make a 1 year validity starting from 7 days ago
208         start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
209         end = start + TimeUnit.DAYS.toMillis(365);
210         cbld.setValidity(new Date(start), new Date(end));
211 

171         addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
172         addCommonCAExts(cbld);
173         // Make our Root CA Cert!
174         rootCert = cbld.build(null, rootCaKP.getPrivate(),
175                 "SHA256withECDSA");
176         log("Root CA Created:\n%s", certInfo(rootCert));
177 
178         // Now build a keystore and add the keys and cert
179         rootKeystore = keyStoreBuilder.getKeyStore();
180         Certificate[] rootChain = {rootCert};
181         rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
182                 passwd.toCharArray(), rootChain);
183 
184         // Now fire up the OCSP responder
185         rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
186         rootOcsp.enableLog(debug);
187         rootOcsp.setNextUpdateInterval(3600);
188         rootOcsp.setDisableContentLength(true);
189         rootOcsp.start();
190 
191         // Wait 60 seconds for server ready
192         boolean readyStatus = rootOcsp.awaitServerReady(60, TimeUnit.SECONDS);
193         if (!readyStatus) {
194             throw new RuntimeException("Server not ready");
195         }
196 
197         rootOcspPort = rootOcsp.getPort();
198         String rootRespURI = "http://localhost:" + rootOcspPort;
199         log("Root OCSP Responder URI is %s", rootRespURI);
200 
201         // Now that we have the root keystore and OCSP responder we can
202         // create our end entity certificate
203         cbld.reset();
204         cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
205         cbld.setPublicKey(eeKP.getPublic());
206         cbld.setSerialNumber(new BigInteger("4096"));
207         // Make a 1 year validity starting from 7 days ago
208         start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
209         end = start + TimeUnit.DAYS.toMillis(365);
210         cbld.setValidity(new Date(start), new Date(end));
211 
< prev index next >