예제 #1
0
 public HttpPostIntTest() {
   Log4jInit.setLevel("ca.nrc.cadc.net", Level.DEBUG);
   String hostname = NetUtil.getServerName(HttpPostIntTest.class);
   baseHttpUrl = "http://" + hostname + "/test";
   baseHttpsUrl = "https://" + hostname + "/test";
   SSL_CERT = FileUtil.getFileFromResource(TEST_CERT_FN, HttpDownloadTest.class);
   SSL_KEY = FileUtil.getFileFromResource(TEST_KEY_FN, HttpDownloadTest.class);
   System.setProperty(BasicX509TrustManager.class.getName() + ".trust", "true");
 }
예제 #2
0
파일: SSLUtil.java 프로젝트: opencadc/core
 @SuppressWarnings("unchecked")
 public static X509Certificate[] readCertificateChain(File certFile)
     throws CertificateException, IOException {
   try {
     X509Certificate[] chain = readCertificateChain(FileUtil.readFile(certFile));
     log.debug("X509 certificate is valid");
     return chain;
   } catch (CertificateException ex) {
     throw new RuntimeException("certificate from file " + certFile + " is not valid", ex);
   }
 }
예제 #3
0
파일: SSLUtil.java 프로젝트: opencadc/core
 /**
  * Convenience method to parse a PEM encoded file and return the corresponding X509 Certificate
  * chain.
  *
  * @param pemFile
  * @return certificate chain
  * @throws InvalidKeySpecException
  * @throws NoSuchAlgorithmException
  * @throws IOException
  * @throws CertificateException
  */
 public static X509CertificateChain readPemCertificateAndKey(File pemFile)
     throws InvalidKeySpecException, NoSuchAlgorithmException, IOException, CertificateException {
   byte[] data = FileUtil.readFile(pemFile);
   return readPemCertificateAndKey(data);
 }
예제 #4
0
파일: SSLUtil.java 프로젝트: opencadc/core
 public static PrivateKey readPrivateKey(File keyFile)
     throws InvalidKeySpecException, NoSuchAlgorithmException, IOException {
   byte[] priv = FileUtil.readFile(keyFile);
   return readPrivateKey(priv);
 }