docs: static TLSCertificateKeyPair fromX509CertKeyPair(X509Certificate x509Cert, KeyPair keyPair) throws IOException {
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          PrintWriter writer = new PrintWriter(baos);
          JcaPEMWriter w = new JcaPEMWriter(writer);
          w.writeObject(x509Cert);
          w.flush();
          w.close();
          byte[] pemBytes = baos.toByteArray();
  
          InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(pemBytes));
          PemReader pr = new PemReader(isr);
          PemObject pem = pr.readPemObject();
          byte[] derBytes = pem.getContent();
  
          baos = new ByteArrayOutputStream();
          PrintWriter wr = new PrintWriter(baos);
          wr.println("-----BEGIN PRIVATE KEY-----");
          wr.println(new String(Base64.encodeBase64(keyPair.getPrivate().getEncoded())));
          wr.println("-----END PRIVATE KEY-----");
          wr.flush();
          wr.close();
          byte[] keyBytes = baos.toByteArray();
          return new TLSCertificateKeyPair(pemBytes, derBytes, keyBytes);
      }