Esempio n. 1
0
        private MemoryStream EncryptNSignInMemory(string text)
        {
            using (ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt())
            {
                MemoryStream a = new System.IO.MemoryStream();

                byte[]       byteArray = Encoding.UTF8.GetBytes(text);
                MemoryStream stream    = new MemoryStream(byteArray);
                pgp.EncryptAndSign(stream, a, "Sample_Pub.asc", "Sample_Pri.asc", "Test123", true, false);
                return(a);
            }
        }
Esempio n. 2
0
 public void EncryptNSign()
 {
     using (ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt())
     {
         using (Stream input = File.OpenRead("SampleData.txt"))
         {
             using (Stream output = File.OpenWrite("SampleData.PGP"))
             {
                 pgp.EncryptAndSign(input, output, "Sample_Pub.asc", "Sample_Pri.asc", "Test123", true, false);
             }
         }
     }
     Console.WriteLine("PGP Encryption done.");
 }
Esempio n. 3
0
 private static void EncryptNSign()
 {
     using (ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt())
     {
         using (Stream input = File.OpenRead("SampleData.txt"))
         {
             using (Stream output = File.OpenWrite("SampleData.PGP"))
             {
                 //pgp.CompressionAlgorithm = ChoCompressionAlgorithm.Zip;
                 pgp.EncryptAndSign(input, output, "Sample_Pub.asc", "Sample_Pri.asc", "Test123", true, false);
             }
         }
     }
     Console.WriteLine("PGP Encryption done.");
 }