docs: public Enrollment reenroll(User user, EnrollmentRequest req) throws EnrollmentException, InvalidArgumentException {
  
          if (cryptoSuite == null) {
              throw new InvalidArgumentException("Crypto primitives not set.");
          }
  
          if (user == null) {
              throw new InvalidArgumentException("reenrollment user is missing");
          }
          if (user.getEnrollment() == null) {
              throw new InvalidArgumentException("reenrollment user is not a valid user object");
          }
  
          logger.debug(format("re-enroll user: %s, url: %s", user.getName(), url));
  
          try {
              setUpSSL();
  
              PublicKey publicKey = cryptoSuite.bytesToCertificate(user.getEnrollment().getCert()
                      .getBytes(StandardCharsets.UTF_8)).getPublicKey();
  
              KeyPair keypair = new KeyPair(publicKey, user.getEnrollment().getKey());
  
              // generate CSR
  
              String pem = cryptoSuite.generateCertificationRequest(user.getName(), keypair);
  
              // build request body
              req.setCSR(pem);
              if (caName != null && !caName.isEmpty()) {
                  req.setCAName(caName);
              }
              String body = req.toJson();
  
              // build authentication header
              JsonObject result = httpPost(url + HFCA_REENROLL, body, user);
  
              // get new cert from response
              Base64.Decoder b64dec = Base64.getDecoder();
              String signedPem = new String(b64dec.decode(result.getString("Cert").getBytes(UTF_8)));
              logger.debug(format("[HFCAClient] re-enroll returned pem:[%s]", signedPem));
  
              logger.debug(format("reenroll user %s done.", user.getName()));
              return new X509Enrollment(keypair, signedPem);
  
          } catch (EnrollmentException ee) {
              logger.error(ee.getMessage(), ee);
              throw ee;
          } catch (Exception e) {
              EnrollmentException ee = new EnrollmentException(format("Failed to re-enroll user %s", user), e);
              logger.error(e.getMessage(), e);
              throw ee;
          }
      }