public static void main(String[] args){

KeyGenerator kg;

SecretKey sk ;

Cipher cipher = null;

String str = "程度上发";

Key publicKey = null;

Security.addProvider(new com.sun.crypto.provider.SunJCE());
try {


kg = KeyGenerator.getInstance("AES");
Key sqk = kg.generateKey();
cipher = Cipher.getInstance("AES");
cipher.init(Cipher.WRAP_MODE, sqk);
byte[] dd = cipher.wrap(sqk);
cipher.init(Cipher.ENCRYPT_MODE, sqk);
byte[] strbyte = cipher.doFinal(str.getBytes());

System.out.println("dd:"+dd.length);

Cipher cipher1 =  Cipher.getInstance("AES");
KeyGenerator kg1 = KeyGenerator.getInstance("AES");
Key umkey = cipher1.unwrap(dd, "AES", Cipher.SECRET_KEY);
System.out.println(new String(cipher1.doFinal(strbyte)));


} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchPaddingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvalidKeyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
运行后报:java.lang.IllegalStateException: Cipher not initialized
at javax.crypto.Cipher.unwrap(DashoA13*..)
at AESTest.main(AESTest.java:52)   接收端怎么初始化Cipher ? 没有Key对象Cipher也能初始化的吗? 大大能帮我解决这个问题吧啊,急啊。