VB.NET
' Rijndael 暗号化アルゴリズムによってファイルを複合化する方法
Using fStream = File.Open("encrypted.txt", FileMode.OpenOrCreate)
Dim RijndaelAlg As Rijndael = Rijndael.Create
Using cStream As New CryptoStream(fStream,
RijndaelAlg.CreateDecryptor(RijndaelAlg.Key, RijndaelAlg.IV),
CryptoStreamMode.Read)
Using sReader As New StreamReader(cStream)
Dim plainText = sReader.ReadLine()
End Using
End Using
End Using
C#
// Rijndael 暗号化アルゴリズムによってファイルを複合化する方法
{
using (fStream == File.Open("encrypted.txt", FileMode.OpenOrCreate)) {
Rijndael RijndaelAlg = Rijndael.Create;
using (CryptoStream cStream = new CryptoStream(fStream, RijndaelAlg.CreateDecryptor(RijndaelAlg.Key, RijndaelAlg.IV), CryptoStreamMode.Read)) {
using (StreamReader sReader = new StreamReader(cStream)) {
dynamic plainText = sReader.ReadLine();
}
}
}
}