docs: public static BasicCredential buildCredentialForMetadataSignatureValidation(final Resource resource) throws Exception {
          try {
              val x509FactoryBean = new BasicX509CredentialFactoryBean();
              x509FactoryBean.setCertificateResource(resource);
              x509FactoryBean.afterPropertiesSet();
              return x509FactoryBean.getObject();
          } catch (final Exception e) {
              LOGGER.trace(e.getMessage(), e);
  
              LOGGER.debug("Credential cannot be extracted from [{}] via X.509. Treating it as a public key to locate credential...", resource);
              val credentialFactoryBean = new BasicResourceCredentialFactoryBean();
              credentialFactoryBean.setPublicKeyInfo(resource);
              credentialFactoryBean.afterPropertiesSet();
              return credentialFactoryBean.getObject();
          }
      }