java 加密後的密文:iP6nVfCE9Eiw47utJDR6wV6Lhl4xyOgYykub0HUJSZQ=以下是java 的aes 加密類,希望能用php 解密出來
package com.mk.api.util; .security.MessageDigest;import java.util.Arrays;import javax.crypto.Cipher;import javax.crypto.spec.SecretKeySpec;import javax.xml.bind.DatatypeConverter;/*** AES 加密*/public class Aprivatev static final String AESTYPE = "AES"; OoSppcVWb2q34qENBJkudXUh4MWcreondLmLL2UyydtFKuU9Sa5VgY/CzGaVGJABK2ZR94="; /** * 加密 * @param content * @return */ public static String encryKey(String ) (); Cipher c = Cipher.getInstance(AESTYPE); tedValue = DatatypeConverter.printBase64Binary(encVal); return encryptedValue; } catch (Exception e) { e.printStackTrace(); } return null Key key = generateKey(); Cipher c = Cipher.getInstance(AESTYPE); c.init(Cipher.DECRYPT_MODE, key); byte[] decordedValue = DataECRYPT_MODE, key); byte[] decordedValue =Data String decryptedValue = new String(decValue) ; return decryptedValue; } catch (Exception e) { e.printStackTrace(); } return null; te[] keyValue = KEY.getBytes("UTF-8"); MessageDigest sha = MessageDigest.getInstance("SHA-1"); keyValue = sha.digest(keyValue); keyValue = Arrays.copyOf(keyValue, 16); Key key = new SecretKeySpec(keyValue, AESTYPE); return key; } }
看看這個://m.sbmmt.com/php-weizijiaocheng-455991.html
上面程式碼格式亂了