public static String encodeBase64(final byte[] data, final boolean chunked) {
        if (data != null && data.length > 0) {
            if (chunked) {
                return BASE64_CHUNKED_ENCODER.encodeToString(data).trim();
            }
            return BASE64_UNCHUNKED_ENCODER.encodeToString(data).trim();
        }
        return StringUtils.EMPTY;
    }
Base64-encode the given byte[] as a string.

@param data    the byte array to encode
@param chunked the chunked
@return the encoded string
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java