This project has moved and is read-only. For the latest updates, please go here.


The AesCng class provides a wrapper for the CNG implementation of the AES algorithm. It provides the same interface as the other AES implementations shipped with the .NET Framework, including System.Security.Cryptography.AesManaged and System.Security.Cryptography.AesCryptoServiceProvider .

AesCng uses the BCrypt layer of CNG to do its work, and requires Windows Vista and the .NET Framework 3.5.

Since most of the AesCng APIs are inherited from the System.Security.Cryptography.Aes base class, see the documentation for Aes for a complete API description.


.ctor(System.Security.Cryptography.CngProvider algorithmProvider)

Constructs an AesCng object using the specified algorithm provider. The default settings for this object are:
  • Algorithm provider - Microsoft Primitive Algorithm Provider
  • Block size - 128 bits
  • Feedback size - 8 bits
  • Key size - 256 bits
  • Cipher mode - CipherMode.CBC
  • Padding mode - PaddingMode.PKCS7

algorithmProvider algorithm provider to use for AES computation

System.ArgumentNullException if algorithmProvider is null

System.Security.Cryptography.CipherMode Mode { get; set; }

Gets or sets the cipher mode to use during encryption or decryption. Supported modes are:
  • CipherMode.CBC
  • CipherMode.ECB
  • CipherMode.CFB

Last edited Jun 4, 2009 at 1:05 AM by shawnfa, version 6


No comments yet.