public void WriteValue(string value)
{
Cryptkeeper myCrypt = new Cryptkeeper(this.passphrase);
byte[] cipherBytes = myCrypt.GetBytes(value, Cryptkeeper.Action.Encrypt);
byte[] cleartext = myCrypt.GetBytes(cipherBytes, Cryptkeeper.Action.Decrypt);
byte[] lengthBytes = BitConverter.GetBytes((uint)cipherBytes.Length);
byte[] buffer = new byte[lengthBytes.Length + cipherBytes.Length];
Array.Copy(lengthBytes, 0, buffer, 0, lengthBytes.Length);
Array.Copy(cipherBytes, 0, buffer, lengthBytes.Length, cipherBytes.Length);
this.EmbedBytesInPage(buffer);
// If this is a file info, write the bytes down to the file while preserving the file dates
if (this.isFileInfo)
{
// Write the bytes to the file and then reset last access time.
DateTime created = this.webPageFile.CreationTime;
DateTime modified = this.webPageFile.LastWriteTime;
DateTime accessed = this.webPageFile.LastAccessTime;
BinaryWriter writeFile = new BinaryWriter(File.Open(this.webPageFile.FullName, FileMode.Create));
writeFile.Write(this.GetBytes());
writeFile.Close();
this.webPageFile.CreationTime = created;
this.webPageFile.LastWriteTime = modified;
this.webPageFile.LastAccessTime = accessed;
}
}