Base64 Encoded Strings - longtomin/FrInMeBa GitHub Wiki

Base64 Encoding

For security reason so that nobody can enter signs like < or /> in a string of a rest function, all strings which are transfered to the server must be base64 encoded.

We check at each function if it is a valid base64 string with this code.

public boolean checkValueMust(String in) {
	logger.debug("Start CheckValueMust with Value = " + in);
	boolean ret = false;
	if (in == null || in.isEmpty()) {
		lastError = Constants.NO_CONTENT_GIVEN;
	} else {
		if (in.equals((base64Encode(base64Decode(in))))) {
			ret = true;
			lastError = "";
		} else {
			lastError = Constants.ENCODING_ERROR;
		}
	}
	logger.debug("End checkValueMust with ret = " + ret);
	return ret;
}

The check is simply done by decodeing and encoding the given string an compare if they are equal. If the check returns false, then the lastError variable has the last occured error and can be used to fill the Errortext of the Out.... Jaxb class.

⚠️ **GitHub.com Fallback** ⚠️