/// <summary> /// Make an archive of the files in TestData\CompressTestFolder /// </summary> /// <param name="rsa">The RSA provider.</param> /// <externalUnit/> /// <revision revisor="dev05" date="03/06/09" version="1.0.8.17"> /// Method created. /// </revision> /// <revision revisor="dev05" date="03/16/09" version="1.0.8.27"> /// Pass a timestamp to OpenWrite(). /// </revision> private void MakeArchive(RSACryptoServiceProvider rsa) { SignedArchive sa = new SignedArchive(this.tempPath, "archive.zip"); sa.OpenWrite(rsa, DateTime.Parse("03/19/2009")); foreach (string pathName in Directory.GetFiles(this.tempPath)) { string fileName = Path.GetFileName(pathName); if (fileName == "archive.zip") { continue; } sa.AddFile(fileName); } sa.Close(); }
public void ExtractTest() { var rsa = new RSACryptoServiceProvider(); this.CleanTempPath(true); this.PopulateTempPath(); this.MakeArchive(rsa); string publicKey = rsa.ToXmlString(false); rsa.FromXmlString(publicKey); this.CleanTempPath(false); OperationResult result = SignedArchive.ExtractAll( this.tempPath, Path.Combine(this.tempPath, "archive.zip"), rsa); Assert.IsTrue(result.Succeeded); }