package com.yc.ship.module.trade.framework.common;

import org.apache.commons.codec.binary.Base64;

import java.io.UnsupportedEncodingException;

public class Base64Util {

	// 加密  
    public static String encode(String data) {
        String result= null;
        try {
            result = Base64.encodeBase64String(data.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return  result;
    }  
  
    // 解密  
    public static String decode(String data) {
        String  result = null;
        try {
            result = new String(Base64.decodeBase64(data),"UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return result;
    }
}
