June 2003
Intermediate to advanced
800 pages
34h 20m
English
You need to symmetrically encrypt data that isn’t stream-based, such as a series of variables.
Write these variables to a MemoryStream, and wrap this with a CryptoStream.
All symmetric encryption is stream-based. If you need to convert data that’s stored in ordinary variables such as integers and strings, you must write this data to an in-memory stream.
The following Console application demonstrates this approach.
Public Module EncryptionTest Public Sub Main() ' Declare the data. Dim Name As String = "Joe Tester" Dim Age As Integer = 28 ' Create the in-memory stream. Dim ms As New System.IO.MemoryStream() ' Create the cryptographic object. Dim Rijndael As New RijndaelManaged() ' Write and encrypt ...
Read now
Unlock full access