code: public static X509Certificate readCertificate(final Resource resource) {
          try (val in = resource.getInputStream()) {
              return CertUtil.readCertificate(in);
          } catch (final Exception e) {
              throw new IllegalArgumentException("Error reading certificate " + resource, e);
          }
      }
docs: Read certificate x 509 certificate.
  
  @param resource the resource
  @return the x 509 certificate