Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
AesManaged Constructor
Collapse the table of content
Expand the table of content

AesManaged Constructor

Initializes a new instance of the AesManaged class.

Namespace:  System.Security.Cryptography
Assembly:  System.Core (in System.Core.dll)

'Declaration
Public Sub New

The following example demonstrates how to use the AesManaged constructor when you encrypt an isolated storage file. This code example is part of a larger example provided for the AesManaged class.


Using aes = New System.Security.Cryptography.AesManaged()
    Dim deriveBytes As New Rfc2898DeriveBytes(passwordBox.Password, Encoding.UTF8.GetBytes(PasswordSalt))
    aes.Key = deriveBytes.GetBytes(128 / 8)
    If Integer.MaxValue = Int64.MaxValue Then intSize = 8
    isoStoreStream.Write(BitConverter.GetBytes(aes.IV.Length), 0, intSize)
    isoStoreStream.Write(aes.IV, 0, aes.IV.Length)
    Using cs As New CryptoStream(isoStoreStream, aes.CreateEncryptor(), CryptoStreamMode.Write)
        Dim rawPlaintext As Byte() = Encoding.Unicode.GetBytes(inputBox.Text)
        cs.Write(rawPlaintext, 0, rawPlaintext.Length)
        cs.FlushFinalBlock()
    End Using
End Using


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft