示例#1
0
        public static string EncryptCode(string line)
        {
            bool   fileExists    = File.Exists("codenc.txt");
            bool   encFileExists = File.Exists("codencF.txt");
            string plainTxt      = "codenc.txt";
            string encTxt        = "codencF.txt";

            if (fileExists == true)
            {
                File.Delete(plainTxt);
            }
            StreamWriter fle = File.CreateText(plainTxt);

            fle.Write(line);
            fle.Close();

            if (encFileExists == true)
            {
                File.Delete(encTxt);
            }

            FileStream fleStr        = new FileStream(encTxt, FileMode.Create);
            FileInfo   fleInf        = new FileInfo(plainTxt);
            PgpEncKeys pgpEncKeys    = new PgpEncKeys("recipient_pgp_public.txt", "pgp_private.txt", "unioflincoln");
            Encryption pgpEncryption = new Encryption(pgpEncKeys);

            pgpEncryption.EncryptSign(fleStr, fleInf);
            fleStr.Close();

            string rtn = File.ReadAllText(encTxt);

            //Commented out for testing purposes.
            //File.Delete(encTxt);
            //File.Delete(plainTxt);
            return(rtn);
        }
示例#2
0
 public Encryption(PgpEncKeys encKeys)
 {
     mPgpKeys = encKeys;
 }