Illegal Access Error when retrieving Secret Key from JCEKS Keystore
843810Apr 25 2002 — edited Apr 25 2002
The following is thrown when I attempt to access a SecretKey from a JCEKS keystore:
I am using jdk1.3.1_02.
java.lang.IllegalAccessError: try to access field javax.crypto.SealedObject.encodedParams from class com.sun.crypto.provider.ai
at com.sun.crypto.provider.ai.a([DashoPro-V1.2-120198])
at com.sun.crypto.provider.ae.a([DashoPro-V1.2-120198])
at com.sun.crypto.provider.JceKeyStore.engineGetKey([DashoPro-V1.2-120198])
at java.security.KeyStore.getKey(KeyStore.java:250)
at KeyTester.main(KeyTester.java:94)
Exception in thread "main"
The testing code fragment is:
Given: keystorefile, storepass, alias
KeyStore teststore = KeyStore.getInstance("JCEKS", "SunJCE");
teststore.load( new FileInputStream( keystorefile ), storepass.toCharArray() );
SecretKey readcsk = (SecretKey)teststore.getKey( alias, storepass.toCharArray() );
The keystore has the correct contents using keytool. I can load the keystore. I can verify the alias
exists in the keystore and that it is a "keyEntry".
The odd thing about this problem is that I have the exact same code running on a laptop with no
problem. Therefore I believe that it is environmental but I cannot figure out what particular environment
thing I am missing.
Thanks
G