package com.litesuits.common.data.cipher;


import com.litesuits.common.assist.Base64;

/**
 * @author MaTianyu
 * @date 14-7-31
 */
public class Base64Cipher extends Cipher {
    private Cipher cipher;

    public Base64Cipher() {
    }

    public Base64Cipher(Cipher cipher) {
        this.cipher = cipher;
    }

    @Override
    public byte[] decrypt(byte[] res) {
        if(cipher != null) res = cipher.decrypt(res);
        return Base64.decode(res, Base64.DEFAULT);
    }

    @Override
    public byte[] encrypt(byte[] res) {
        if(cipher != null) res = cipher.encrypt(res);
        return Base64.encode(res, Base64.DEFAULT);
    }
}

@@ -374,33 +374,33 @@
       if(cipher 
-!
+=
 = null) res = ci
@@ -397,30 +397,46 @@
 ) re
-s = cipher.decrypt(res
+turn Base64.decode(res, Base64.DEFAULT
 );%0A 
@@ -440,29 +440,26 @@
 ;%0A        re
-turn 
+s=
 Base64.decod
@@ -478,24 +478,61 @@
 4.DEFAULT);%0A
+        return cipher.decrypt(res);;%0A
     %7D%0A%0A    @

修改多次加密失败问题，加密时Base64是最后加密，所以解密时也需要先使用Base64解密，后再使用其他解密