Aes-encrypted java decryption publicstaticStringEncrypt (StringsSrc, StringsKey) throwsException {byte [] rawsKey. getBytes (); decrypt (raw, & quot; AES & q aes-encrypted java decryption
Public static String Encrypt (String sSrc, String sKey) throws Exception {
Byte [] raw = sKey. getBytes ();
SecretKeySpec skeySpec = new SecretKeySpec (raw, "AES ");
Cipher cipher = Cipher. getInstance ("AES/CBC/PKCS5Padding ");
IvParameterSpec iv = new IvParameterSpec ("0102030405060708". getBytes ());
Cipher. init (Cipher. ENCRYPT_MODE, skeySpec, iv );
Byte [] encrypted = cipher. doFinal (sSrc. getBytes ());
Return new BASE64Encoder (). encode (encrypted );
}
String cKey = "1234567890 ";
// The string to be encrypted
String cSrc = "testtest ";
System. out. println (cSrc );
// Encryption
Long lStart = System. currentTimeMillis ();
String enString = AES. Encrypt (cSrc, cKey );
System. out. println ("The encrypted string is:" + enString );
Java is implemented using PHP. the encrypted string is different from that of java.
Please help me use PHP to implement this java encryption function,
------ Solution --------------------
Do not assume that everyone has a java environment and can correctly execute your code.
You must provide at least three groups of original texts and ciphertext.