我很有趣下面的代码来生成 sessionkeu
public byte[] generateSessionKey() throws NoSuchAlgorithmException, NoSuchProviderException
{
KeyGenerator kgen = KeyGenerator.getInstance("AES","BC");
kgen.init(256);
SecretKey key = kgen.generateKey();
byte[] symmKey = key.getEncoded();
return symmKey;
}
并在这里打印
byte[] aa=encryptor.generateSessionKey();
String s1=new String(aa);
System.out.println(s1);
输出是
Çɤđy3F:¦ïó‹AOÜYu•{Öç„>r?Ô–
我做对了吗?