title: How to initialize provider for pkcs11?
body: <p>I want to use nss as a provider for pkcs11 and I'm coding in java, on oracle JRE and ubuntu 64bit. I tried 2 different wrappers, iaik and SunPKCS11 but in both I had the same problem. For my provider, I first tried to use libnss3.so and each time I got IOException in instancing module. Then I use libsoftokn3.so and I succeeded instancing a module. But now I face this exception on initializing: "CKR_ARGUMENTS_BAD"</p>
  
  <p>Here is my codes, first using iaik and the second one using SunPKCS11</p>
  
  <p>iaiak:</p>
  
  <pre><code>        Module pkcs11Module = Module.getInstance("libsoftokn.so");
          pkcs11Module.initialize(null);      //Here Throws the Excption:"iaik.pkcs.pkcs11.wrapper.PKCS11Exception: CKR_ARGUMENTS_BAD"
          Info info = pkcs11Module.getInfo();
          System.out.println(info);
          pkcs11Module.finalize(null);
  </code></pre>
  
  <p>SunPKCS11:</p>
  
  <pre><code>    String configName = "cfg";
      Provider p = new sun.security.pkcs11.SunPKCS11(configName);  //Here Throws the Excption:"sun.security.pkcs11.wrapper.PKCS11Exception: CKR_ARGUMENTS_BAD"
      Security.addProvider(p);
  </code></pre>
  
  <p>and the file "cfg":</p>
  
  <pre><code>name = nss
  library = /usr/lib/libsoftokn3.so
  </code></pre>