M
mav
NOTE: This message is about IBM iSeries JAVA programming with the
IBMJCE.
I am testing my Java code on the iSeries and continue to run in to a
persistent issue. I have made a cryptographic provider for Java as a
project, and it works perfectly on Windows. However, I run into an
issue on the iSeries when I attempt to use the AES (Rijndael)
algorithm. Here's the code I run:
SecretKeyFactory aesFactory = SecretKeyFactory.getInstance("AES");
SecretKeySpec x = new SecretKeySpec(aes256Key, 0, 32, "AES");
System.out.println("Pre generateSecret() Size: " +
x.getEncoded().length);
aesKey = aesFactory.generateSecret(x);
System.out.println("Post generateSecret() Size: " +
aesKey.getEncoded().length);
The variable "aes256Key" is a filled byte array of length 32. When
I run this code, I get an output like the following:
Pre generateSecret() Size: 32
Post generateSecret() Size: 16
When I print the arrays, the Post-generateSecret() array is exactly the
first 16 bytes of the pre-genarateSecret() array. (i.e., if the
"Pre" array is <0,1,2,3,...,31>, the "Post" array is
<0,1,2,3...15>). However, no error was thrown; the array was just
truncated.
I thought this was an issue with the Unlimited Strength Jurisdiction
Policy Files, but the behavior remained the same when I updated them.
I also attempted to do this with TripleDES instead of AES, but the code
worked fine.
Does the IBM JCE limit AES to 128-bits without even throwing an error?
Any insight would be greatly appreciated.
Thank you very much,
-Matt
IBMJCE.
I am testing my Java code on the iSeries and continue to run in to a
persistent issue. I have made a cryptographic provider for Java as a
project, and it works perfectly on Windows. However, I run into an
issue on the iSeries when I attempt to use the AES (Rijndael)
algorithm. Here's the code I run:
SecretKeyFactory aesFactory = SecretKeyFactory.getInstance("AES");
SecretKeySpec x = new SecretKeySpec(aes256Key, 0, 32, "AES");
System.out.println("Pre generateSecret() Size: " +
x.getEncoded().length);
aesKey = aesFactory.generateSecret(x);
System.out.println("Post generateSecret() Size: " +
aesKey.getEncoded().length);
The variable "aes256Key" is a filled byte array of length 32. When
I run this code, I get an output like the following:
Pre generateSecret() Size: 32
Post generateSecret() Size: 16
When I print the arrays, the Post-generateSecret() array is exactly the
first 16 bytes of the pre-genarateSecret() array. (i.e., if the
"Pre" array is <0,1,2,3,...,31>, the "Post" array is
<0,1,2,3...15>). However, no error was thrown; the array was just
truncated.
I thought this was an issue with the Unlimited Strength Jurisdiction
Policy Files, but the behavior remained the same when I updated them.
I also attempted to do this with TripleDES instead of AES, but the code
worked fine.
Does the IBM JCE limit AES to 128-bits without even throwing an error?
Any insight would be greatly appreciated.
Thank you very much,
-Matt