java 用aes  "AES/ECB/PKCS5Padding" 加密后怎么用php解密  请php高手帮帮忙
以下是java代码public class AesCrypImpl{ private String algorithm = "AES"; private String transformation = "AES/ECB/PKCS5Padding"; private String key = "21V32fe_e3.tu1A8"; private String provider; private ThreadLocal<JavaCrypto> local = new ThreadLocal<JavaCrypto>(); private JavaCrypto getLocalCrypto() {
JavaCrypto current = local.get();
if (current == null) {
current = new JavaCrypto(algorithm, transformation, key, provider);
local.set(current);
}
return current;
} private static class JavaCrypto {
private Cipher enCipher; private Cipher deCipher; public JavaCrypto(String algorithm, String transformation, String key,
String provider) {
super();
try {
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(),
algorithm);
if (provider == null) {
enCipher = Cipher.getInstance(transformation);
deCipher = Cipher.getInstance(transformation);
} else {
enCipher = Cipher.getInstance(transformation, provider);
deCipher = Cipher.getInstance(transformation, provider);
}
enCipher.init(Cipher.ENCRYPT_MODE, secretKey);
deCipher.init(Cipher.DECRYPT_MODE, secretKey);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (NoSuchPaddingException e) {
throw new RuntimeException(e);
} catch (InvalidKeyException e) {
throw new RuntimeException(e);
} catch (NoSuchProviderException e) {
throw new RuntimeException(e);
}
} public byte[] encrypt(byte[] bs) {
try {
return enCipher.doFinal(bs);
} catch (IllegalBlockSizeException e) {
throw new RuntimeException(e);
} catch (BadPaddingException e) {
throw new RuntimeException(e);
}
} public byte[] dectypt(byte[] bs) {
try {
return deCipher.doFinal(bs);
} catch (IllegalBlockSizeException e) {
throw new RuntimeException(e);
} catch (BadPaddingException e) {
throw new RuntimeException(e);
}
}
} public String dectypt(String s) {
return dectypt(s, null);
} public String dectypt(String s, String charset) {
if (s == null) {
throw new NullPointerException("dectypt string can't be null");
}
try {
byte[] bs = (charset != null) ? Base64.decodeBase64(s
.getBytes(charset)) : Base64.decodeBase64(s.getBytes());
bs = dectypt(bs);
String back = (charset != null) ? new String(bs, charset)
: new String(bs);
back = back.trim();
return back;
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} public byte[] dectypt(byte[] bytes) {
if (bytes == null) {
throw new NullPointerException("dectypt bytes can't be null");
}
return this.getLocalCrypto().dectypt(bytes);
} public String encrypt(String s) {
return encrypt(s, null);
} public String encrypt(String s, String charset) {
if (s == null) {
throw new NullPointerException("encrypt string can't be null");
}
try {
byte[] bs = (charset != null) ? this.encrypt(s.getBytes(charset))
: this.encrypt(s.getBytes());

bs = Base64.encodeBase64(bs);
return (charset != null) ? new String(bs, charset) : new String(bs);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} public byte[] encrypt(byte[] bytes) {
if (bytes == null) {
throw new NullPointerException("encrypt bytes can't be null");
}
return this.getLocalCrypto().encrypt(bytes);
} public String getAlgorithm() {
return algorithm;
} public void setAlgorithm(String algorithm) {
this.algorithm = algorithm;
} public String getKey() {
return key;
} public void setKey(String key) {
this.key = key;
} public String getTransformation() {
return transformation;
} public void setTransformation(String transformation) {
this.transformation = transformation;
} public String getProvider() {
return provider;
} public void setProvider(String provider) {
this.provider = provider;
}

public static void main(String[] args) throws UnsupportedEncodingException {

AesCrypImpl a = new AesCrypImpl();
String aaa = a.encrypt("genevieve");
System.out.println(aaa);
byte[] bs = Base64.encodeBase64("genevieve".getBytes());
System.out.println(new String(bs) );
//String dd = URLDecoder.decode("HORd4oijA6qhR%2Fdxod%2BlIg%3D%3D", "UTF-8");
//System.out.println(dd);
//String aa = a.dectypt(URLDecoder.decode("HORd4oijA6qhR%2Fdxod%2BlIg%3D%3D", "UTF-8"), "UTF-8");
//System.out.println(aa);
}}