private void encryptnew() { FileInfo fi = new FileInfo(path1); //GetFile(); string path = ConfigurationSettings.AppSettings["NEW_FILE"].ToString(); // Delete the file if it exists. if (File.Exists(path)) { File.Delete(path); } //Create the file. using (FileStream fs = fi.Create()) { Byte[] info = new UTF8Encoding(true).GetBytes("This is some text in the file."); // Add some information to the file. fs.Write(info, 0, info.Length); fs.Flush(); fs.Close(); FileStream str = new FileStream(path, FileMode.Create); PgpEncryptionKeys objPgpEncryptionKeys = new PgpEncryptionKeys(PublicKey, PrivateKey, password, true); PgpEncrypt objPgpEncrypt = new PgpEncrypt(objPgpEncryptionKeys); objPgpEncrypt.EncryptAndSign(str, fi); str.Flush(); str.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)