public void TestCreateDocumentBadArgument()
        {
            AxCryptFactory axFactory = new AxCryptFactory();

            IAxCryptDocument document = null;

            Assert.Throws <ArgumentException>(() => document = axFactory.CreateDocument(new EncryptionParameters(Guid.NewGuid(), new Passphrase("toohigh"))));
            Assert.That(document, Is.Null);
        }
 public void TestV1Document()
 {
     using (MemoryStream inputStream = new MemoryStream(Resources.david_copperfield_key__aa_ae_oe__ulu_txt))
     {
         AxCryptFactory axFactory = new AxCryptFactory();
         IEnumerable <DecryptionParameter> decryptionParameters = DecryptionParameter.CreateAll(new Passphrase[] { new Passphrase("Å ä Ö") }, null, new Guid[] { new V1Aes128CryptoFactory().CryptoId });
         using (IAxCryptDocument decryptedDocument = axFactory.CreateDocument(decryptionParameters, inputStream))
         {
             Assert.That(decryptedDocument.PassphraseIsValid);
         }
     }
 }
 public void TestV2Document()
 {
     using (MemoryStream inputStream = new MemoryStream())
     {
         byte[] text = Resolve.RandomGenerator.Generate(500);
         inputStream.Write(text, 0, text.Length);
         inputStream.Position = 0;
         byte[] buffer = new byte[2500];
         using (V2AxCryptDocument document = new V2AxCryptDocument(new EncryptionParameters(new V2Aes256CryptoFactory().CryptoId, new Passphrase("properties")), 15))
         {
             document.EncryptTo(inputStream, new MemoryStream(buffer), AxCryptOptions.EncryptWithCompression);
         }
         AxCryptFactory axFactory = new AxCryptFactory();
         IEnumerable <DecryptionParameter> decryptionParameters = DecryptionParameter.CreateAll(new Passphrase[] { new Passphrase("properties") }, null, new Guid[] { new V2Aes256CryptoFactory().CryptoId });
         using (IAxCryptDocument decryptedDocument = axFactory.CreateDocument(decryptionParameters, new MemoryStream(buffer)))
         {
             Assert.That(decryptedDocument.PassphraseIsValid);
         }
     }
 }