title: PBKDF2WithHmacSHA512 SecretKeyFactory not available error
body: <p>I am trying to use the <strong>Security API</strong> in <strong>Java EE 8</strong>, hashing the password. I created a <strong>@DatabaseIdentityStoreDefinition</strong></p>
  
  <pre><code>@BasicAuthenticationMechanismDefinition(
      realmName = "Book Realm"
  )
  @DatabaseIdentityStoreDefinition(
      dataSourceLookup = "jdbc/userAuth",
      callerQuery = "select password from users where USERNAME = ?",
      groupsQuery = "select g.GROUP_NAME from USER_GROUPS ug, users u, GROUPS g where ug.USER_ID = u.user_id and g.GROUP_ID= ug.GROUP_ID and u.USERNAME=?"
      hashAlgorithm = Pbkdf2PasswordHash.class,
      hashAlgorithmParameters = {
              "Pbkdf2PasswordHash.Iterations=3072",
              "Pbkdf2PasswordHash.Algorithm=PBKDF2WithHmacSHA512",
              "Pbkdf2PasswordHash.SaltSizeBytes=64"
      }
  )
  @DeclareRoles({"user", "admin"})
  @WebServlet("/securedServlet")
  @ServletSecurity(
      @HttpConstraint(rolesAllowed = {"admin"}))
  public class SecuredServlet extends HttpServlet {
  
  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      response.getWriter().write("Congratulations, login successful.");
      }
  }
  </code></pre>
  
  <p>when I deploy the war file to the Glassfish 5 application server I get the following exception:</p>
  
  <pre><code>java.lang.IllegalStateException: java.security.NoSuchAlgorithmException: PBKDF2WithHmacSHA512 SecretKeyFactory not available
  </code></pre>
  
  <p>This exception comes from the class that I have created to automaticly create and insert the user in to the database.</p>
  
  <p>The relevant parts of this class:</p>
  
  <pre><code>@Resource(mappedName = "jdbc/userAuth")
  private DataSource dataSource;
  
  @Inject
  private Pbkdf2PasswordHash passwordHash;
  
  public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
          Map&lt;String, String&gt; parameters = new HashMap&lt;&gt;();
          parameters.put("Pbkdf2PasswordHash.Iterations", "3072");
          parameters.put("Pbkdf2PasswordHash.Algorithm", "PBKDF2WithHmacSHA512");
          parameters.put("Pbkdf2PasswordHash.SaltSizeBytes", "64");
          passwordHash.initialize(parameters);
          executeUpdate(dataSource, "INSERT INTO USERS (USER_ID,USERNAME,FIRST_NAME,MIDDLE_NAME,LAST_NAME,PASSWORD) VALUES (1,'beaver','Beaver','The Dam','Lake','" + passwordHash.generate("beaverattack".toCharArray()) + "')");
  </code></pre>
  
  <p>In the pom.xml I have the following dependencies:</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;javax&lt;/groupId&gt;
    &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
    &lt;version&gt;8.0&lt;/version&gt;
    &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;javax.security.enterprise&lt;/groupId&gt;
    &lt;artifactId&gt;javax.security.enterprise-api&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Java version: </p>
  
  <pre><code>java version "1.8.0_211"
  Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
  Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
  </code></pre>