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) return Base64.decode(res, Base64.DEFAULT);
        res=Base64.decode(res, Base64.DEFAULT);
        return cipher.decrypt(res);;
    }

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

@@ -376,33 +376,13 @@
     
-if(cipher == null) return
+res =
  Bas
@@ -426,48 +426,34 @@
     
-res=Base64.decode(res, Base64.DEFAULT);%0A
+if (cipher != null) %7B%0A    
     
@@ -458,20 +458,19 @@
       re
-turn
+s =
  cipher.
@@ -482,16 +482,45 @@
 pt(res);
+%0A        %7D%0A        return res
 ;%0A    %7D%0A
@@ -584,16 +584,17 @@
       if
+ 
 (cipher 
@@ -601,16 +601,30 @@
 != null)
+ %7B%0A           
  res = c
@@ -635,32 +635,42 @@
 r.encrypt(res);%0A
+        %7D%0A
         return B

优化 base 64 加解密