/** * This method loads a certificate from the given location. The certificate must be DER-encoded and may be supplied in binary or printable * (Base64) encoding. If the certificate is provided in Base64 encoding, it must be bounded at the beginning by -----BEGIN CERTIFICATE-----, and * must be bounded at the end by -----END CERTIFICATE-----. It throws an {@code DSSException} or return {@code null} when the * certificate cannot be loaded. * * @param file * @return */ public static X509Certificate loadCertificate(final File file) throws DSSException { final InputStream inputStream = DSSUtils.toByteArrayInputStream(file); final X509Certificate x509Certificate = loadCertificate(inputStream); return x509Certificate; }
@Override public Reports validateDocument(final File policyFile) { if (policyFile == null || !policyFile.exists()) { return validateDocument((InputStream) null); } final InputStream inputStream = DSSUtils.toByteArrayInputStream(policyFile); return validateDocument(inputStream); }