Click here to Skip to main content
15,916,835 members
Home / Discussions / C#
   

C#

 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
DaveyM696-Dec-07 11:39
professionalDaveyM696-Dec-07 11:39 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
Skippums7-Dec-07 5:36
Skippums7-Dec-07 5:36 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
DaveyM699-Dec-07 23:43
professionalDaveyM699-Dec-07 23:43 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
Skippums10-Dec-07 4:34
Skippums10-Dec-07 4:34 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
DaveyM6910-Dec-07 5:08
professionalDaveyM6910-Dec-07 5:08 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
Skippums10-Dec-07 5:58
Skippums10-Dec-07 5:58 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
DaveyM6910-Dec-07 10:02
professionalDaveyM6910-Dec-07 10:02 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
Skippums6-Dec-07 9:16
Skippums6-Dec-07 9:16 
If you are using NTFS, do the following (adding try/catch as appropriate):

public static void Encrypt(XmlDocument ThisDocument, string targetFile) {
    FileStream outFile = new FileStream(targetFile, FileMode.OpenOrCreate, FileAccess
        .Write, FileShare.None, 0x1000, FileOptions.Encrypted| FileOptions.SequentialScan);
    ThisDocument.Save(outFile);
    outFile.Close();
}
public static XmlDocument Decrypt(string sourceFile) {
    FileStream inFile = new FileStream(sourceFile, FileMode.Open, FileAccess
        .Read, FileShare.None, 0x1000, FileOptions.Encrypted | FileOptions.SequentialScan);
    ThisDocument.Save(outFile);
    inFile.Close();
}


I am currently tired of typing, but I will explain how to do it another way in a bit, in case you are not using NTFS.


-Jeff

GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
Ennis Ray Lynch, Jr.6-Dec-07 9:19
Ennis Ray Lynch, Jr.6-Dec-07 9:19 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
Skippums6-Dec-07 9:56
Skippums6-Dec-07 9:56 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
DaveyM696-Dec-07 11:18
professionalDaveyM696-Dec-07 11:18 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
ekynox6-Dec-07 9:24
ekynox6-Dec-07 9:24 
GeneralRe: File (XmlDocument) Encryption / Decryption improvements Pin
DaveyM696-Dec-07 11:19
professionalDaveyM696-Dec-07 11:19 
GeneralDatabinding not updating Business Object property Pin
Bert delaVega6-Dec-07 7:32
Bert delaVega6-Dec-07 7:32 
GeneralRe: Databinding not updating Business Object property Pin
darkelv6-Dec-07 16:36
darkelv6-Dec-07 16:36 
GeneralRe: Databinding not updating Business Object property Pin
Bert delaVega7-Dec-07 11:04
Bert delaVega7-Dec-07 11:04 
GeneralLINQ Question Pin
martin_hughes6-Dec-07 7:10
martin_hughes6-Dec-07 7:10 
GeneralRe: LINQ Question Pin
DaveyM696-Dec-07 8:25
professionalDaveyM696-Dec-07 8:25 
GeneralRe: LINQ Question Pin
martin_hughes6-Dec-07 10:01
martin_hughes6-Dec-07 10:01 
GeneralRe: LINQ Question Pin
darkelv6-Dec-07 14:25
darkelv6-Dec-07 14:25 
General*shakes fist at board* Pin
darkelv6-Dec-07 14:49
darkelv6-Dec-07 14:49 
GeneralResolving a domain name to IP address Pin
Skippums6-Dec-07 7:08
Skippums6-Dec-07 7:08 
GeneralRe: Resolving a domain name to IP address Pin
Bert delaVega6-Dec-07 8:28
Bert delaVega6-Dec-07 8:28 
GeneralRe: Resolving a domain name to IP address Pin
Skippums6-Dec-07 8:54
Skippums6-Dec-07 8:54 
GeneralRe: Resolving a domain name to IP address Pin
Bert delaVega6-Dec-07 9:11
Bert delaVega6-Dec-07 9:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.