SecretKey from byte[]
Is it possible to make a SecretKey using byte[]? I have tried several things, the one that looks most promising is setting the bytes in an InputStream and reading them with ObjectInputStream as a SecretKey. This errors out though with an IOException. Is there another way of doing this? Here is my current code: InputStream keyStream =new ByteArrayInputStream(newbyte[]{70, 76, 87, 95, 99, 71,
53, -101, 68, -7, -63, 4, -121, 14, -2, -87, 28});
SecretKey key =null;
try{
ObjectInputStream ois =new ObjectInputStream(keyStream);
key = (SecretKey) ois.readObject();
ois.close();
}catch (ClassNotFoundException ex){
System.err.println("Error: Class not found.");
}catch (IOException ex){
System.err.println("Unable to read stream.");
}

