code: public String encodeSigningRequest(PKCS10CertificationRequest csr) {
          logger.entry();
          try (StringWriter swriter = new StringWriter(); PemWriter pwriter = new PemWriter(swriter)) {
              pwriter.writeObject(new PemObject("CERTIFICATE REQUEST", csr.getEncoded()));
              pwriter.flush();
              String result = swriter.toString();
              logger.exit();
              return result;
          } catch (IOException e) {
              RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to encode a certificate signing request.", e);
              logger.error(exception.toString());
              throw exception;
          }
      }
docs: This method encodes a certificate signing request (CSR) into a string for transport purposes.
  This is a convenience method that really should be part of the
  <code>CertificateManagement</code> interface except that it depends on a Bouncy Castle
  class in the signature.  The java security framework does not have a similar class so it
  has been left out of the interface.
  
  @param csr The certificate signing request.
  @return The encoded certificate signing request string.