日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql aes java解密_加密/解密的Java函數,如Mysql的AES_ENCRYPT和AES_DECRYPT

發布時間:2024/10/8 数据库 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql aes java解密_加密/解密的Java函數,如Mysql的AES_ENCRYPT和AES_DECRYPT 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1

If you need the code to decrypt the algorithm is here JAVA

如果你需要代碼解密算法就在這里JAVA

public static String aes_decrypt(String passwordhex, String strKey) throws Exception {

try {

byte[] keyBytes = Arrays.copyOf(strKey.getBytes("ASCII"), 16);

SecretKey key = new SecretKeySpec(keyBytes, "AES");

Cipher decipher = Cipher.getInstance("AES");

decipher.init(Cipher.DECRYPT_MODE, key);

char[] cleartext = passwordhex.toCharArray();

byte[] decodeHex = Hex.decodeHex(cleartext);

byte[] ciphertextBytes = decipher.doFinal(decodeHex);

return new String(ciphertextBytes);

} catch (Exception e) {

e.getMessage();

}

return null;

}

It received a standard hex format string but variable and returns the password. Test with those in main method

它收到一個標準的十六進制格式字符串但變量並返回密碼。用主方法測試

System.out.println(aes_encrypt("your_string_password", "your_string_key"));

System.out.println(aes_decrypt("standard_hex_format_string ", "your_string_key"));

firstable test only with encrypt, then just with decrypt. By the way you must install 'commons-codec-1.6.jar' so you can use the Hex class http://commons.apache.org/proper/commons-codec/download_codec.cgi

只有加密才能進行第一次測試,然后只需要解密。順便說一下,你必須安裝'commons-codec-1.6.jar',這樣你才能使用Hex類http://commons.apache.org/proper/commons-codec/download_codec.cgi

Greetings from Ecuador, Ibarra

來自厄瓜多爾的問候,Ibarra

總結

以上是生活随笔為你收集整理的mysql aes java解密_加密/解密的Java函數,如Mysql的AES_ENCRYPT和AES_DECRYPT的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。