0
如何從編碼字節[]返回到java.security.Key?Java:從編碼密鑰獲取密鑰
import java.security.Key;
import javax.crypto.SecretKey;
import javax.crypto.KeyGenerator;
public class TestRSA {
public static void main(String[] args) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
SecretKey key = kgen.generateKey();
byte[] encoded = key.getEncoded();
// now, how to get back the Key object from the encoded byte[]?
}
}
這篇文章消失了 – grebulon 2012-11-01 13:26:30