AES ECB模式+BASE64加解密
import org.apache.commons.codec.binary.Base64; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; /** * Created with IntelliJ IDEA. * Description:1 、对明文密码进行加密验证 * 2 、 AES ECB 模式 +BASE64 加密方式 * */ public class AesBase64Utils { private static final String AES_KEY = "123asdadawwad1yhgfdfesdcswerthyyuhsaAXCSESXCVFGD" ; // 加密 public static String Encrypt (String sSrc) throws Exception { byte [] bytes = getSecretKeySpecByte ( AES_KEY ); SecretKeySpec skeySpec = new SecretKeySpec(bytes, "AES" ); Cipher cipher = Cipher. getInstance ( "AES/ECB/PKCS5Padding" ); //" 算法 / 模式 / 补码方式 "