public DigitalSignatureTests() { if (Environment.GetEnvironmentVariable("debug") != null && Environment.GetEnvironmentVariable("debug").Equals("true", StringComparison.CurrentCultureIgnoreCase)) { serialize = true; } Console.Out.WriteLine(Directory.GetCurrentDirectory()); path = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "resources"; if (!Directory.Exists(path)) { path = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + ".." + Path.DirectorySeparatorChar + ".." + Path.DirectorySeparatorChar + "resources"; Console.Out.WriteLine(path); } if (!Directory.Exists(path)) { path = Environment.GetEnvironmentVariable("JUDDI_TEST_RES"); Console.Out.WriteLine(path); } if (path == null || !Directory.Exists(path)) { path = null; Console.Out.WriteLine("uh oh, I can't find the resources directory, override with the environment variable JUDDI_TEST_RES=<path>"); } ds = new DigSigUtil(); ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, path + Path.DirectorySeparatorChar+"cert.pfx"); ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "PFX"); ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "password"); ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "selfsigned"); //the friendly name = alias //ds.put(DigSigUtil.TRUSTSTORE_FILE, "./src/test/resources/truststore.jks"); //ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS"); //ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test"); ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true"); ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true"); ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true"); ds.put(DigSigUtil.CHECK_TIMESTAMPS, "true"); }
void resetDS() { ds = new DigSigUtil(); ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE, path + Path.DirectorySeparatorChar + "cert.pfx"); ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILETYPE, "PFX"); ds.put(DigSigUtil.SIGNATURE_KEYSTORE_FILE_PASSWORD, "password"); ds.put(DigSigUtil.SIGNATURE_KEYSTORE_KEY_ALIAS, "selfsigned"); //the friendly name = alias //ds.put(DigSigUtil.TRUSTSTORE_FILE, "./src/test/resources/truststore.jks"); //ds.put(DigSigUtil.TRUSTSTORE_FILETYPE, "JKS"); //ds.put(DigSigUtil.TRUSTSTORE_FILE_PASSWORD, "Test"); ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true"); ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true"); ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true"); ds.put(DigSigUtil.CHECK_TIMESTAMPS, "true"); }