code: private X509Certificate[] convert(javax.security.cert.X509Certificate[] certs)
              throws CertificateVerificationException {
          X509Certificate[] certChain = new X509Certificate[certs.length];
          Throwable exceptionThrown;
          for (int i = 0; i < certs.length; i++) {
              try {
                  byte[] encoded = certs[i].getEncoded();
                  ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(encoded);
                  CertificateFactory certificateFactory = CertificateFactory.getInstance(Constants.X_509);
                  certChain[i] = ((X509Certificate) certificateFactory.generateCertificate(byteArrayInputStream));
                  continue;
              } catch (CertificateEncodingException | CertificateException e) {
                  exceptionThrown = e;
              }
              throw new CertificateVerificationException("Cant Convert certificates from javax to java", exceptionThrown);
          }
          return certChain;
      }
docs: Convert certificates and create a certificate chain.
  
  @param certs array of javax.security.cert.X509Certificate[] s.
  @return the converted array of java.security.cert.X509Certificate[] s.
  @throws CertificateVerificationException If an error occurs while converting certificates
  from java to javax