Como voltar um encoded byte[] para java.security.Key?

Como voltar um encoded byte[] para java.security.Key?

[code]
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();

// agora, como conseguir o Key a partir do encoded byte[]?

}

}[/code]

Achei! Desculpem o incomodo… :lol:

http://www.exampledepot.com/egs/javax.crypto/GetKeyBytes.html