docs: private X509Certificate getX509Certificate(byte[] pemCertificate) throws CryptoException {
          X509Certificate ret = null;
          CryptoException rete = null;
  
          List<Provider> providerList = new LinkedList<>(Arrays.asList(Security.getProviders()));
          if (SECURITY_PROVIDER != null) { //Add if overridden
              providerList.add(SECURITY_PROVIDER);
          }
          try {
              providerList.add(BouncyCastleProvider.class.newInstance()); // bouncy castle is there always.
          } catch (Exception e) {
              logger.warn(e);
  
          }
          for (Provider provider : providerList) {
              try {
                  if (null == provider) {
                      continue;
                  }
                  CertificateFactory certFactory = CertificateFactory.getInstance(CERTIFICATE_FORMAT, provider);
                  if (null != certFactory) {
                      try (ByteArrayInputStream bis = new ByteArrayInputStream(pemCertificate)) {
                          Certificate certificate = certFactory.generateCertificate(bis);
  
                          if (certificate instanceof X509Certificate) {
                              ret = (X509Certificate) certificate;
                              rete = null;
                              break;
                          }
                      }
  
                  }
              } catch (Exception e) {
  
                  rete = new CryptoException(e.getMessage(), e);
  
              }
  
          }
  
          if (null != rete) {
  
              throw rete;
  
          }
  
          if (ret == null) {
  
              logger.error("Could not convert pem bytes");
  
          }
  
          return ret;
  
      }