public void CreateSubCATest2() { // Setup CaTestHarness.InitialiseCA(true); ICA ca = CaTestHarness.LoadCA(); // Test //string caLocation; Directory.CreateDirectory(CaTestHarness.testHarnessLocation + @"\subCA"); Pkcs10CertificationRequest p10; p10 = CaFactory.CreateSubCA(SysSubCaConfig); Assert.AreEqual("CN=Test subCA Sys", p10.GetCertificationRequestInfo().Subject.ToString()); Assert.IsTrue(p10.Verify()); // Test 2 Profile profile = new Profile(CaTestHarness.testHarnessLocation + @"\subCA.xml"); X509Certificate cert = ca.IssueCertificate(p10, profile); CaFactory.CreateSubCA(CaTestHarness.testHarnessLocation + @"\subCA\CAConfig.xml", cert); ICA subCa = OSCA.OSCA.LoadCA(CaTestHarness.testHarnessLocation + @"\subCA\CAConfig.xml", "foobar"); Assert.AreEqual("CN=Test subCA Sys", subCa.CAName); Assert.IsTrue(subCa.FIPS140Mode); }
public void CreateRootCATest1() { CaTestHarness.InitialiseCA(true); ICA ca = CaTestHarness.LoadCA(); Assert.AreEqual("CN=Test Harness Sys", ca.CAName); Assert.IsTrue(ca.FIPS140Mode); }
public void CreateRootCATest() { CaTestHarness.InitialiseCA(false); ICA ca = CaTestHarness.LoadCA(); Assert.AreEqual("CN=Test Harness BC", ca.CAName); Assert.IsFalse(ca.FIPS140Mode); }
public void MyTestInitialize() { try { CaTestHarness.Cleanup(); } catch (DirectoryNotFoundException) { } try { Directory.Delete(CaTestHarness.testHarnessLocation + @"\subCA", true); } catch (DirectoryNotFoundException) { } }
public void ExportToP12Test() { CaTestHarness.InitialiseCA(true); ICA ca = CaTestHarness.LoadCA(); string password = "******"; //byte[] p12 = ca.Backup(password); //File.WriteAllBytes(CaTestHarness.testHarnessLocation + @"\CA\Backup.pfx", p12); //Read in the private key and certificate FileStream p12stream = new FileStream(CaTestHarness.testHarnessLocation + @"\CA\Backup.pfx", FileMode.Open); Pkcs12Store p12in = new Pkcs12Store(p12stream, password.ToCharArray()); Assert.AreEqual("", p12in.GetCertificateAlias(ca.Certificate)); //Assert.IsNotNull(p12in.GetKey().Key); //Assert.AreSame(ca.Certificate, p12in.GetCertificate(ca.CAName.ToString()).Certificate); }
public void CreateSubCATest1() { // Setup CaTestHarness.InitialiseCA(true); ICA ca = CaTestHarness.LoadCA(); // Test string caLocation; Directory.CreateDirectory(CaTestHarness.testHarnessLocation + @"\subCA"); caLocation = CaFactory.CreateSubCA(SysSubCaConfig, ca); Assert.AreEqual(CaTestHarness.testHarnessLocation + @"\subCA\CAConfig.xml", caLocation); // Test 2 ICA subCa = OSCA.OSCA.LoadCA(caLocation, "foobar"); Assert.AreEqual("CN=Test subCA Sys", subCa.CAName); Assert.IsTrue(subCa.FIPS140Mode); }
public static void MyClassCleanup() { CaTestHarness.Cleanup(); }
public static void MyClassInitialize(TestContext testContext) { CaTestHarness.InitialiseCA(false); }