コード例 #1
0
  /**
   * This method reads a certificate file and returns a {@link X509Certificate}
   *
   * @param certLocation the location of the certificate file
   * @return the created {@link X509Certificate}
   */
  private X509Certificate createCertificate(String certLocation) {
    X509Certificate cert = null;

    try {
      FileInputStream fisCertificate = new FileInputStream(certLocation);
      cert =
          X509Support.decodeCertificate(
              StringSupport.inputStreamToString(fisCertificate, null).getBytes());
      fisCertificate.close();

    } catch (Exception e) {
      return null;
    }
    return cert;
  }
コード例 #2
0
  /**
   * This method reads a certificate file and returns a {@link X509Certificate}
   *
   * @param certLocation the location of the certificate file
   * @return the created {@link X509Certificate}
   */
  private X509Certificate getCertificate(String certLocation) {
    X509Certificate cert = null;

    try {
      FileInputStream fisCertificate = new FileInputStream(certLocation);
      cert =
          X509Support.decodeCertificate(
              StringSupport.inputStreamToString(fisCertificate, null).getBytes());
      fisCertificate.close();

    } catch (Exception e) {
      log.debug("{} Couldnt create the X509Certificate: {}", getLogPrefix(), e);
      return null;
    }
    return cert;
  }