loads a certificate using {@link CertificateHelper#loadCertificate(java.io.InputStream) }

@return
@throws VectorPrintException
170970
protected Certificate loadCertificate() throws VectorPrintException {
      try {
         return CertificateHelper.loadCertificate(getValue(CERTIFICATE, URL.class).openStream());
      } catch (IOException | CertificateException ex) {
         throw new VectorPrintException(ex);
      }
   }
167608
public LOADSTATUS loadFont(URL url) throws IOException, VectorPrintException {
      return loadFont(url.openStream(), url.toString().substring(url.toString().lastIndexOf('.')));
   }
1040136
protected Object writeReplace() throws ObjectStreamException {
        try {
            return new CertPathRep(type, getEncoded());
        } catch (CertificateException ce) {
            NotSerializableException nse =
                new NotSerializableException
                    ("java.security.cert.CertPath: " + type);
            nse.initCause(ce);
            throw nse;
        }
    }
1145140
private X509Certificate loadX509FromPEMFile(String filename) {
        try {
            return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(FileReader.openStreamToFileFromClassPathOrPath(filename));
        } catch (Exception e) {
            throw new RuntimeException("Exception reading X509 from PEM file", e);
        }
    }
28686
static public X509Certificate readCertificate(String filename)
            throws Exception {
        InputStream inStream = null;
        X509Certificate cert = null;
        try {
            inStream = Config.getInstance().getInputStreamFromFile(filename);
            if (inStream != null) {
                CertificateFactory cf = CertificateFactory.getInstance("X.509");
                cert = (X509Certificate) cf.generateCertificate(inStream);
            } else {
                logger.info("Certificate " + Encode.forJava(filename) + " not found.");
            }
        } catch (Exception e) {
            logger.error("Exception: ", e);
        } finally {
            if (inStream != null) {
                try {
                    inStream.close();
                } catch (IOException ioe) {
                    logger.error("Exception: ", ioe);
                }
            }
        }
        return cert;
    }
309584
public static X509Certificate decodeCertificate(InputStream inputStream) throws UaException {
        Preconditions.checkNotNull(inputStream, "inputStream cannot be null");

        CertificateFactory factory;

        try {
            factory = CertificateFactory.getInstance("X.509");
        } catch (CertificateException e) {
            throw new UaException(StatusCodes.Bad_InternalError, e);
        }

        try {
            return (X509Certificate) factory.generateCertificate(inputStream);
        } catch (CertificateException | ClassCastException e) {
            throw new UaException(StatusCodes.Bad_CertificateInvalid, e);
        }
    }
64594
private void parseSSLCertFile() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "parseSSLCertFile");
        }

        String fileName = null;
        String lineRead = null;
        BufferedReader bufferReader = null;

        // Obtain Default Cert Label
        certDefaultLabel = getProperty(PROTOCOL_HTTPS_CERT_DEFAULT_LABEL);

        // Obtain Cert Mapping File
        try {
            fileName = getProperty(PROTOCOL_HTTPS_CERT_MAPPING_FILE);

            if (fileName != null && 0 < fileName.length()) {
                bufferReader = new BufferedReader(new FileReader(fileName));

                // For each entry, parse the label and ip address
                lineRead = bufferReader.readLine();
                while (lineRead != null) {
                    extractSSLServerCert(lineRead.trim());
                    lineRead = bufferReader.readLine();
                }
            }
        } catch (Exception e) {
            FFDCFilter.processException(e, getClass().getName(), "parseSSLCertFile", this);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Error parsing file; " + e);
        } finally {
            if (null != bufferReader) {
                try {
                    bufferReader.close();
                } catch (IOException ioe) {
                    // ignore
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "parseSSLCertFile");
        }
    }
1241562
private void loadCertificateFromFile(File file) {

    certificateFileSanityChecks(file);

    try {

      X509Certificate aaCert = CertificateUtils.loadCertificate(
        new FileInputStream(file), Encoding.PEM);

      // Get certificate subject hash, using the CANL implementation for CA
      // files
      String aaCertHash = getOpensslCAHash(aaCert.getSubjectX500Principal());

      // Store certificate in the local map
      localAACertificatesByHash.put(aaCertHash, aaCert);

      synchronized (listenerLock) {
        listener.notifyCertificateLoadEvent(aaCert, file);
      }

    } catch (IOException e) {
      String errorMessage = String.format(
        "Error parsing VOMS trusted certificate from %s. Reason: %s",
        file.getAbsolutePath(), e.getMessage());
      throw new VOMSError(errorMessage, e);
    }

  }
830644
@Override
  public X509Certificate getClientCertificate()
    throws java.security.cert.CertificateException
  {
    TempBuffer tb = TempBuffer.create();
    byte []buffer = tb.buffer();
    int len = getClientCertificate(_socketFd, buffer, 0, buffer.length);
    X509Certificate cert = null;

    if (len > 0 && len < buffer.length) {
      try {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        InputStream is = new ByteArrayInputStream(buffer, 0, len);
        cert = (X509Certificate) cf.generateCertificate(is);
        is.close();
      } catch (IOException e) {
        return null;
      }
    }

    TempBuffer.free(tb);
    tb = null;

    return cert;
  }
18925
public final X509Certificate retrieveCertificate(KeyStore keyStore, String certificateName) {
        try {
            logger.entry();
            X509Certificate certificate = (X509Certificate) keyStore.getCertificate(certificateName);
            logger.exit();
            return certificate;
        } catch (KeyStoreException e) {
            RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a certificate.", e);
            logger.error(exception.toString());
            throw exception;
        }
    }
423683
@Override
    protected byte[] load(ConfidentialKey key) throws IOException {
        try {
            File f = getFileFor(key);
            if (!f.exists())    return null;

            Cipher sym = Secret.getCipher("AES");
            sym.init(Cipher.DECRYPT_MODE, masterKey);
            try (InputStream fis=Files.newInputStream(f.toPath());
                 CipherInputStream cis = new CipherInputStream(fis, sym)) {
                byte[] bytes = IOUtils.toByteArray(cis);
                return verifyMagic(bytes);
            }
        } catch (GeneralSecurityException e) {
            throw new IOException("Failed to load the key: "+key.getId(),e);
        } catch (InvalidPathException e) {
            throw new IOException(e);
        } catch (IOException x) {
            if (x.getCause() instanceof BadPaddingException) {
                return null; // broken somehow
            } else {
                throw x;
            }
        }
    }
114957
public static X509CertImpl toImpl(X509Certificate cert)
            throws CertificateException {
        if (cert instanceof X509CertImpl) {
            return (X509CertImpl)cert;
        } else {
            return X509Factory.intern(cert);
        }
    }
1266010
public static String getThumbprint(final X509Certificate cert) throws CertificateEncodingException {

		if(cert == null)
		{
			return null;
		}

		byte[] rawOctets = cert.getEncoded();

		SHA1Digest digest = new SHA1Digest();

		byte[] digestOctets = new byte[digest.getDigestSize()];

		digest.update(rawOctets, 0, rawOctets.length);

		digest.doFinal(digestOctets, 0);

		return new String(Base64.encode(digestOctets));
	}
442409
public X509Certificate createCertificate(InputStream certRequestInputStream, X509Certificate cert,
        PrivateKey privateKey, int lifetime, int delegationMode, X509ExtensionSet extSet) throws IOException,
        GeneralSecurityException {
        return createCertificate(certRequestInputStream, cert, privateKey, lifetime, delegationMode, extSet, null);
    }
1329780
public static void writeCertificate(OutputStream out,
                                        X509Certificate cert)
        throws IOException, CertificateEncodingException {
        CertificateIOUtil.writeCertificate(out, cert);
    }
690734
public static PublicKey readPublicKey(InputStream pemStream) {
		final Certificate certificate = KeyUtil.readX509Certificate(pemStream);
		if(null == certificate) {
			return null;
		}
		return certificate.getPublicKey();
	}
1284393
public OCSPReq build() throws OCSPException, IOException, CertificateEncodingException {
        SecureRandom generator = checkNotNull(this.generator, "generator");
        DigestCalculator calculator = checkNotNull(this.calculator, "calculator");
        X509Certificate certificate = checkNotNull(this.certificate, "certificate");
        X509Certificate issuer = checkNotNull(this.issuer, "issuer");

        BigInteger serial = certificate.getSerialNumber();

        CertificateID certId = new CertificateID(calculator,
                new X509CertificateHolder(issuer.getEncoded()), serial);

        OCSPReqBuilder builder = new OCSPReqBuilder();
        builder.addRequest(certId);

        byte[] nonce = new byte[8];
        generator.nextBytes(nonce);

        Extension[] extensions = new Extension[] {
                new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false,
                        new DEROctetString(nonce)) };

        builder.setRequestExtensions(new Extensions(extensions));

        return builder.build();
    }