[
https://issues.jboss.org/browse/ELY-1295?page=com.atlassian.jira.plugin.s...
]
Peter Palaga commented on ELY-1295:
-----------------------------------
I was able to figure out how to avoid the {{NoSuchAlgorithmException}} reported above
through this fix:
https://github.com/ppalaga/wildfly-elytron/commit/7d6b37230d7c277f0a96d36...
Basically a similar hack is necessary for IBM JDK like we already have for Oracle JDK. The
{{JceSecurity}} analogon is obfuscated in IBM JDK. It is called {{javax.crypto.b}} and the
map field caching the validation results is called {{j}}.
It can still be manipulated via reflection to make IBM JDK think that the code in
{{target/classes}} passed the cert validation.
But having this workaround in place does not make the whole test pass. For
{{format=PKCS12}}, there is a new exception that I was not able to solve in any way:
{code}
java.security.UnrecoverableKeyException: Get Key failed: Get Key failed: Unrecognized key
type.
at com.ibm.crypto.provider.PKCS12KeyStoreOracle.engineGetKey(Unknown Source)
at com.ibm.crypto.provider.PKCS12KeyStoreOracle.engineGetEntry(Unknown Source)
at java.security.KeyStore.getEntry(KeyStore.java:1532)
at
org.wildfly.security.credential.store.impl.KeyStoreCredentialStore.retrieve(KeyStoreCredentialStore.java:462)
at
org.wildfly.security.credential.store.impl.KeyStoreCredentialStoreTest.shouldSupportKeyStoreFormat(KeyStoreCredentialStoreTest.java:155)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:156)
at
mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:65)
at
mockit.integration.junit4.internal.MockFrameworkMethod.invokeExplosively(MockFrameworkMethod.java:37)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
Caused by: java.security.UnrecoverableKeyException: Get Key failed: Unrecognized key
type.
... 45 more
{code}
I am giving up here unless somebody has an idea how to proceed.
KeyStoreCredentialStoreTest fails on IBM JDK
--------------------------------------------
Key: ELY-1295
URL:
https://issues.jboss.org/browse/ELY-1295
Project: WildFly Elytron
Issue Type: Bug
Reporter: Peter Palaga
Assignee: Darran Lofthouse
{code}
export JAVA_HOME=path/to/ibm/java8
$JAVA_HOME/bin/java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build pxa6480sr3fp12-20160919_01(SR3 FP12))
IBM J9 VM (build 2.8, JRE 1.8.0 Linux amd64-64 Compressed References 20160915_318796 (JIT
enabled, AOT enabled)
J9VM - R28_Java8_SR3_20160915_0912_B318796
JIT - tr.r14.java.green_20160818_122998
GC - R28_Java8_SR3_20160915_0912_B318796_CMPRSS
J9CL - 20160915_318796)
JCL - 20160914_01 based on Oracle jdk8u101-b13
mvn clean test -Dtest=KeyStoreCredentialStoreTest
{code}
Expected: KeyStoreCredentialStoreTest should pass
Actual: First, the "hack to make JCE believe that it has verified the signature of
the WildFlyElytronProvider JAR" [1] throws
{code}
java.lang.ClassNotFoundException: javax.crypto.JceSecurity
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:278)
at
org.wildfly.security.credential.store.impl.KeyStoreCredentialStoreTest.installWildFlyElytronProvider(KeyStoreCredentialStoreTest.java:89)
...
{code}
because {{javax.crypto.JceSecurity}} does not exist in IBM JRE.
It looks like the hack is actually not necessary anymore, because
{{KeyStoreCredentialStoreTest}} is passing also without the hack on both Oracle JDK and
OpenJDK.
But once the hack is removed, on IBM JDK, {{shouldSupportKeyStoreFormat}} passes with
format=JCEKS but fails with format=PKCS12 throwing the following exeception:
{code}
org.wildfly.security.credential.store.CredentialStoreException: ELY09504: Cannot acquire
a credential from the credential store
at
org.wildfly.security.credential.store.impl.KeyStoreCredentialStore.retrieve(KeyStoreCredentialStore.java:464)
at
org.wildfly.security.credential.store.impl.KeyStoreCredentialStoreTest.shouldSupportKeyStoreFormat(KeyStoreCredentialStoreTest.java:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
Caused by: java.security.UnrecoverableKeyException: Get Key failed: 1.2.840.113549.1.7.1
SecretKeyFactory not available
at java.security.KeyStore.getEntry(KeyStore.java:1532)
at
org.wildfly.security.credential.store.impl.KeyStoreCredentialStore.retrieve(KeyStoreCredentialStore.java:462)
... 10 more
Caused by: java.security.NoSuchAlgorithmException: 1.2.840.113549.1.7.1 SecretKeyFactory
not available
... 12 more
{code}
[1]
https://github.com/wildfly-security/wildfly-elytron/pull/661/commits/7296...
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)