package com.cm.params;

import com.cm.AesUtil;
import com.cm.token.IToken;
import org.apache.commons.codec.binary.Base64;

/**
 * @author Administrator
 * @version 1.0
 * @className ParamsIn
 * @description TODO
 * @date 2018/12/7 18:06
 **/
public class ParamsOut {

    /**
     * 提交参数加密
     *
     * @param params
     * @return
     * @throws Exception
     */
    public static String paramsOutEncode(String params) throws Exception {
        return Base64.encodeBase64String(AesUtil.aesEncoder("cmxxParamsOut", params).getBytes(IToken.CHARSET_NAME_UTF_8));
    }

    /**
     * 相应参数解密
     *
     * @param outParams
     * @return
     * @throws Exception
     */
    public static String paramsInDecoder(String outParams) throws Exception {
        return AesUtil.aesDecoder("cmxxParamsIn", new String(Base64.decodeBase64(outParams), IToken.CHARSET_NAME_UTF_8));
    }

}
