Skip to content

Commit

Permalink
优化 base 64 加解密
Browse files Browse the repository at this point in the history
  • Loading branch information
氢一 committed May 26, 2017
1 parent 4580693 commit 907a252
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ public Base64Cipher(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);;
res = Base64.decode(res, Base64.DEFAULT);
if (cipher != null) {
res = cipher.decrypt(res);
}
return res;
}

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

0 comments on commit 907a252

Please sign in to comment.