类 AESUtil

java.lang.Object
com.xingyuv.captcha.util.AESUtil

public class AESUtil extends Object
  • 字段详细资料

  • 构造器详细资料

    • AESUtil

      public AESUtil()
  • 方法详细资料

    • getKey

      public static String getKey()
      获取随机key
      返回:
      随机key
    • binary

      public static String binary(byte[] bytes, int radix)
      将byte[]转为各种进制的字符串
      参数:
      bytes - byte[]
      radix - 可以转换进制的范围,从Character.MIN_RADIX到Character.MAX_RADIX,超出范围后变为10进制
      返回:
      转换后的字符串
    • base64Encode

      public static String base64Encode(byte[] bytes)
      base 64 encode
      参数:
      bytes - 待编码的byte[]
      返回:
      编码后的base 64 code
    • base64Decode

      public static byte[] base64Decode(String base64Code) throws Exception
      base 64 decode
      参数:
      base64Code - 待解码的base 64 code
      返回:
      解码后的byte[]
      抛出:
      Exception - e
    • aesEncryptToBytes

      public static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception
      AES加密
      参数:
      content - 待加密的内容
      encryptKey - 加密密钥
      返回:
      加密后的byte[]
      抛出:
      Exception - e
    • aesEncrypt

      public static String aesEncrypt(String content, String encryptKey) throws Exception
      AES加密为base 64 code
      参数:
      content - 待加密的内容
      encryptKey - 加密密钥
      返回:
      加密后的base 64 code
      抛出:
      Exception - e
    • aesDecryptByBytes

      public static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception
      AES解密
      参数:
      encryptBytes - 待解密的byte[]
      decryptKey - 解密密钥
      返回:
      解密后的String
      抛出:
      Exception - e
    • aesDecrypt

      public static String aesDecrypt(String encryptStr, String decryptKey) throws Exception
      将base 64 code AES解密
      参数:
      encryptStr - 待解密的base 64 code
      decryptKey - 解密密钥
      返回:
      解密后的string
      抛出:
      Exception - e