Vishal Mahajan wrote:

Sean Mullan wrote:

Vishal Mahajan wrote:

Dominik Schadow wrote:

Yes, I tried the following code:

SecretKeySpec keySpec = new
SecretKeySpec(JavaUtils.getBytesFromFile(keyFile), algorithm);
    SecretKey key = skf.generateSecret(keySpec);

The exception I receive is

java.security.NoSuchAlgorithmException: AES not found
at javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:86)

I think the problem is that you don't have a JCE provider in your jre that supports AES key generation this way. I am not sure which provider supports it.



Sun's JCE provider supports AES with J2SE/JDK 1.4.2 and up.


Yes J2SE/JDK 1.4.2 and up support AES algorithm for most of the crypto functions. What seems to be missing is a SecretKeyFactory supporting AES.

Right.

The solution (which I believe you hinted about before) is to just use the AES SecretKeySpec directly (since it is a subclass of SecretKey). There is no reason to use a SecretKeyFactory to convert it to a SecretKey.

--Sean

Reply via email to