Ejemplo n.º 1
0
  public static void testNSS(PKCS11Test test) throws Exception {
    if (!(new File(NSS_BASE)).exists()) return;

    String libdir = getNSSLibDir();
    if (libdir == null) {
      return;
    }

    if (loadNSPR(libdir) == false) {
      return;
    }

    String libfile = libdir + System.mapLibraryName("softokn3");

    String customDBdir = System.getProperty("CUSTOM_DB_DIR");
    String dbdir = (customDBdir != null) ? customDBdir : NSS_BASE + SEP + "db";
    // NSS always wants forward slashes for the config path
    dbdir = dbdir.replace('\\', '/');

    String customConfig = System.getProperty("CUSTOM_P11_CONFIG");
    String customConfigName = System.getProperty("CUSTOM_P11_CONFIG_NAME", "p11-nss.txt");
    String p11config = (customConfig != null) ? customConfig : NSS_BASE + SEP + customConfigName;

    System.setProperty("pkcs11test.nss.lib", libfile);
    System.setProperty("pkcs11test.nss.db", dbdir);
    Provider p = getSunPKCS11(p11config);
    test.premain(p);
  }
Ejemplo n.º 2
0
 public static void testDeimos(PKCS11Test test) throws Exception {
   if (new File("/opt/SUNWconn/lib/libpkcs11.so").isFile() == false
       || "true".equals(System.getProperty("NO_DEIMOS"))) {
     return;
   }
   if (!(new File(NSS_BASE)).exists()) return;
   String p11config = NSS_BASE + SEP + "p11-deimos.txt";
   Provider p = getSunPKCS11(p11config);
   test.premain(p);
 }
Ejemplo n.º 3
0
  public static void testDefault(PKCS11Test test) throws Exception {
    // run test for default configured PKCS11 providers (if any)

    if ("true".equals(System.getProperty("NO_DEFAULT"))) {
      return;
    }

    Provider[] providers = Security.getProviders();
    for (int i = 0; i < providers.length; i++) {
      Provider p = providers[i];
      if (p.getName().startsWith("SunPKCS11-")) {
        test.premain(p);
      }
    }
  }