public static PrivateKey parsePrivateKey(String pemRepresentation, String passPhrase) throws IOException {

        if (pemRepresentation == null || pemRepresentation.trim().isEmpty()) {
            throw new IllegalArgumentException("Argument 'pemRepresentation' cannot be null or an empty String.");
        }

        ByteArrayInputStream input = new ByteArrayInputStream(pemRepresentation.getBytes(StandardCharsets.UTF_8));
        return parsePrivateKey(input, passPhrase);
    }
Generates a PEM representation of the input argument.

@param object the input argument (cannot be null).
@return PEM representation of the input argument.
@throws IOException When a PEM representation of the input could not be created.
xmppserver/src/main/java/org/jivesoftware/util/CertificateManager.java