1 Reply Latest reply on Nov 7, 2011 3:06 PM by Anil Saldanha

    Programatically create an SHA256 password hash.

    Pablo Ochoa Newbie

      Hello, I'm trying to implement code to generate hashed SHA256 passwords, in a way that they could be used with the Picketbox's DatabaseLoginModule, the encryption mode I would like to use is SHA. For this I got a recomendation to use Picketbox library, especifically this part of code:



      import org.jboss.security.auth.spi.Util;
      public class SHAHasher implements Hasher {
          public String generateHash(final String stringToHash) {
              String hashedPassword = Util.createPasswordHash("SHA-256",
               null, null, stringToHash);
              return hashedPassword;


      This works great, by including org.jboss.security.auth.spi.Util class (included in modules/org/picketbox/main/picketbox-4.0.0.Final.jar), in the project. But since this is a maven based project, wich dependency could I use in order to compile the war??. It's just to compile, because I'm deploying to a Jboss AS7 server wich includes picketbox library by default.

      Thanks a lot.