[keycloak-user] Crypto

Remi Cartier remi.cartier at imetrik.com
Mon Oct 5 16:38:09 EDT 2015


Hy guys,

I am trying to use some crypto to match hashes from my old db.
The code is :

            KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), 2048, 160);
            SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
            byte[] hash = secretKeyFactory.generateSecret(keySpec).getEncoded();

I cant make it work as a federation provider.

it was complaining about java.lang.ClassNotFoundException: javax.crypto.spec.PBEKeySpec

I added jce.jar to the list of dependencies in my module.xml (I shouldn’t have to do that)

Then I got :

ClassNotFoundException: sun.security.jca.GetInstance

I added rt.jar (which I shouldn’t do either)

and then I got some fancy exception : java.lang.LinkageError: loader constraint violation

I then tried with bouncy castle : bcprov-jdk15on-152.jar to no avail.

what is wrong ?

here is my module.xml file :

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.imetrik.saas.server.services.insuranceWebUIBackend.dao.federation">
    <resources>
        <resource-root path="insuranceWebUIBackend-lib-2.0.5-SNAPSHOT.jar"/>
        <resource-root path="jdbi-2.63.1.jar"/>
        <resource-root path="postgresql-9.4-1203-jdbc4.jar"/>
        <resource-root path="slf4j-api-1.7.12.jar"/>
        <resource-root path="slf4j-simple-1.7.12.jar"/>
        <resource-root path="global-library-common-2.0.4.jar"/>
        <resource-root path="jce.jar"/>
        <resource-root path="bcprov-jdk15on-152.jar"/>
    </resources>
    <dependencies>
        <module name="org.keycloak.keycloak-core"/>
        <module name="org.keycloak.keycloak-model-api"/>
    </dependencies>
</module>


Cheers.

________________________________

REMI CARTIER
B.O.S.S. (Business & Operation Support Systems) P.O (Product Owner)

IMETRIK GLOBAL INC.
T : +1 514 448-6407 x2009
T : +1 866 276-5382 (toll free)
F : +1 514 904-0611

740 Notre Dame St. West, Suite 1575
Montreal, Quebec, Canada H3C 3X6
imetrik.com<http://www.imetrik.com/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151005/082a40e5/attachment-0001.html 


More information about the keycloak-user mailing list