public static byte[] decode(byte[] in) {
        byte[] rewritten = new byte[in.length];
        for (int i = 0; i < in.length; i++) {
            if (in[i] == '.') rewritten[i] = '+';
            else if (in[i] == '_') rewritten[i] = '/';
            else if (in[i] == '-') rewritten[i] = '=';
            else rewritten[i] = in[i];
        }
        return Base64.getDecoder().decode(rewritten);
    }
Variant of {@link java.util.Base64} with the following modifications:
- {@code +} is replaced by {@code .}
- {@code /} is replaced by {code _}
- {@code =} is replaced by {code -}

@author bjorncs
security-utils/src/main/java/com/yahoo/security/YBase64.java