title: Trouble instantiating a JavaKeyStore from file
body: <p>I'm trying to get an instance of <code>org.apache.ws.security.components.crypto.Merlin</code> using <code>org.apache.ws.security.components.crypto.CryptoFactory</code> specifically the <code>CryptoFactory.getInstance(properties)</code> method.</p>
  
  <p>This will consistantly throw </p>
  
  <p><code>java.lang.RuntimeException: org.apache.ws.security.components.crypto.Merlin cannot create instance</code></p>
  
  <p>which evantually is caused by</p>
  
  <p><code>java.security.UnrecoverableKeyException: Password verification failed</code></p>
  
  <p>The password on the keystore file has been checked with the keytool on the command line and is correct.</p>
  
  <p>the keystore is generated via the following process:</p>
  
  <p><img src="https://i.stack.imgur.com/GkQvo.jpg" alt="CMD Window detailing keytool -genkey -keystore testkeystore.jks"></p>
  
  <p>Which is in the root directory of the eclipse porject.</p>
  
  <p>The test applciation is as follows:</p>
  
  <pre><code>public class App {
      public static void main(String[] args) throws CredentialException,
              IOException {
          System.out.println("Starting");
          Properties p = new Properties();
          p.setProperty("org.apache.ws.security.crypto.merlin.keystore.password",
                  "password");
          p.setProperty("org.apache.ws.security.crypto.provider",
                  "org.apache.ws.security.components.crypto.Merlin");
          p.setProperty("org.apache.ws.security.crypto.merlin.keystore.type",
                  "jks");
          p.setProperty("org.apache.ws.security.crypto.merlin.file", "./testkeystore.jks");
  
          Crypto crypto = CryptoFactory.getInstance(p);
          System.out.println(" Complete ");
  
      }
  }
  </code></pre>
  
  <p>and the following exception is generated:</p>
  
  <pre><code>Exception in thread "main" java.lang.RuntimeException: org.apache.ws.security.components.crypto.Merlin cannot create instance
      at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:225)
      at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:180)
      at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:73)
      at com.restart.test.cryptotest2.App.main(App.java:22)
  Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      at org.apache.ws.security.components.crypto.CryptoFactory.loadClass(CryptoFactory.java:211)
      ... 3 more
  Caused by: org.apache.ws.security.components.crypto.CredentialException: Failed to load credentials.
      at org.apache.ws.security.components.crypto.AbstractCrypto.load(AbstractCrypto.java:174)
      at org.apache.ws.security.components.crypto.AbstractCrypto.&lt;init&gt;(AbstractCrypto.java:135)
      at org.apache.ws.security.components.crypto.Merlin.&lt;init&gt;(Merlin.java:71)
      ... 8 more
  Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect
      at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:772)
      at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
      at java.security.KeyStore.load(KeyStore.java:1214)
      at org.apache.ws.security.components.crypto.AbstractCrypto.load(AbstractCrypto.java:168)
      ... 10 more
  Caused by: java.security.UnrecoverableKeyException: Password verification failed
      at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:770)
      ... 13 more
  </code></pre>
  
  <p>The password as indicated in the cmd window is set to "password" , but by all accounts the application is rejecting it, I can change the password using <code>keytool -storepasswd</code> with no issues, So i know the the password I am providing is correct; can anyone suggest what may be going wrong here? I've been trying to debug this unsuccessfully for full a day now.</p>
  
  <p>If there is any additional information I can provide please let me know.</p>
  
  <p>edit --</p>
  
  <p>the folloing maven dependency is required to build this test:</p>
  
  <pre><code>   &lt;dependency&gt; 
        &lt;groupId&gt;org.apache.ws.security&lt;/groupId&gt; 
        &lt;artifactId&gt;wss4j&lt;/artifactId&gt; 
        &lt;version&gt;1.5.8&lt;/version&gt; 
        &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>