Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
AesCng Class
Definition
- Namespace:
- System.Security.Cryptography
- Assembly:
- System.Security.Cryptography.dll
- Assembly:
- System.Security.Cryptography.Cng.dll
- Assemblies:
- System.Security.Cryptography.dll, System.Security.Cryptography.Cng.dll
- Assembly:
- System.Core.dll
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides a Cryptography Next Generation (CNG) implementation of the Advanced Encryption Standard (AES) algorithm.
public ref class AesCng sealed : System::Security::Cryptography::Aes
public sealed class AesCng : System.Security.Cryptography.Aes
type AesCng = class
inherit Aes
Public NotInheritable Class AesCng
Inherits Aes
- Inheritance
Constructors
| Name | Description |
|---|---|
| AesCng() |
Initializes a new instance of the AesCng class with an ephemeral key. |
| AesCng(CngKey) |
Initializes a new instance of the AesCng class with the specified CngKey. |
| AesCng(String, CngProvider, CngKeyOpenOptions) |
Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key, the specified key storage provider (KSP) and key open options. |
| AesCng(String, CngProvider) |
Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key, and the specified key storage provider (KSP). |
| AesCng(String) |
Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key. |
Fields
| Name | Description |
|---|---|
| BlockSizeValue |
Represents the block size, in bits, of the cryptographic operation. (Inherited from SymmetricAlgorithm) |
| FeedbackSizeValue |
Represents the feedback size, in bits, of the cryptographic operation. (Inherited from SymmetricAlgorithm) |
| IVValue |
Represents the initialization vector (IV) for the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
| KeySizeValue |
Represents the size, in bits, of the secret key used by the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
| KeyValue |
Represents the secret key for the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
| LegalBlockSizesValue |
Specifies the block sizes, in bits, that are supported by the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
| LegalKeySizesValue |
Specifies the key sizes, in bits, that are supported by the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
| ModeValue |
Represents the cipher mode used in the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
| PaddingValue |
Represents the padding mode used in the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
Properties
| Name | Description |
|---|---|
| BlockSize |
Gets or sets the block size, in bits, of the cryptographic operation. (Inherited from SymmetricAlgorithm) |
| FeedbackSize |
Gets or sets the feedback size, in bits, of the cryptographic operation for the Cipher Feedback (CFB) and Output Feedback (OFB) cipher modes. (Inherited from SymmetricAlgorithm) |
| IV |
Gets or sets the initialization vector (IV) for the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
| Key |
Gets or sets the key for the AesCng algorithm. |
| KeySize |
Gets or sets the size, in bits, of the secret key used by the AesCng algorithm. |
| LegalBlockSizes |
Gets the block sizes, in bits, that are supported by the symmetric algorithm. (Inherited from Aes) |
| LegalKeySizes |
Gets the key sizes, in bits, that are supported by the symmetric algorithm. (Inherited from Aes) |
| Mode |
Gets or sets the mode for operation of the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
| Padding |
Gets or sets the padding mode used in the symmetric algorithm. (Inherited from SymmetricAlgorithm) |
Methods
| Name | Description |
|---|---|
| Clear() |
Releases all resources used by the SymmetricAlgorithm class. (Inherited from SymmetricAlgorithm) |
| CreateDecryptor() |
Creates a symmetric AES decryptor object with the current key and initialization vector (IV). |
| CreateDecryptor(Byte[], Byte[]) |
Creates a symmetric AES decryptor object with the specified key and initialization vector (IV). |
| CreateEncryptor() |
Creates a symmetric AES encryptor object using the current key and initialization vector (IV). |
| CreateEncryptor(Byte[], Byte[]) |
Creates a symmetric AES encryptor object with the specified key and initialization vector (IV). |
| DecryptCbc(Byte[], Byte[], PaddingMode) |
Decrypts data using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode) |
Decrypts data using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode) |
Decrypts data into the specified buffer, using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| DecryptCfb(Byte[], Byte[], PaddingMode, Int32) |
Decrypts data using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| DecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32) |
Decrypts data using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| DecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) |
Decrypts data into the specified buffer, using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| DecryptEcb(Byte[], PaddingMode) |
Decrypts data using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| DecryptEcb(ReadOnlySpan<Byte>, PaddingMode) |
Decrypts data using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| DecryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode) |
Decrypts data into the specified buffer, using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| DecryptKeyWrapPadded(Byte[]) |
Unwraps a key that was wrapped using the IETF RFC 5649 AES Key Wrap with Padding algorithm. (Inherited from Aes) |
| DecryptKeyWrapPadded(ReadOnlySpan<Byte>, Span<Byte>) |
Unwraps a key that was wrapped using the IETF RFC 5649 AES Key Wrap with Padding algorithm. (Inherited from Aes) |
| DecryptKeyWrapPadded(ReadOnlySpan<Byte>) |
Unwraps a key that was wrapped using the IETF RFC 5649 AES Key Wrap with Padding algorithm. (Inherited from Aes) |
| DecryptKeyWrapPaddedCore(ReadOnlySpan<Byte>, Span<Byte>) |
Unwraps a key that was wrapped using the IETF RFC 5649 AES Key Wrap with Padding algorithm. (Inherited from Aes) |
| Dispose() |
Releases all resources used by the current instance of the SymmetricAlgorithm class. (Inherited from SymmetricAlgorithm) |
| Dispose(Boolean) |
Releases the unmanaged resources used by the SymmetricAlgorithm and optionally releases the managed resources. (Inherited from SymmetricAlgorithm) |
| EncryptCbc(Byte[], Byte[], PaddingMode) |
Encrypts data using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| EncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode) |
Encrypts data using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| EncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode) |
Encrypts data into the specified buffer, using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| EncryptCfb(Byte[], Byte[], PaddingMode, Int32) |
Encrypts data using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32) |
Encrypts data using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) |
Encrypts data into the specified buffer, using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| EncryptEcb(Byte[], PaddingMode) |
Encrypts data using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| EncryptEcb(ReadOnlySpan<Byte>, PaddingMode) |
Encrypts data using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| EncryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode) |
Encrypts data into the specified buffer, using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| EncryptKeyWrapPadded(Byte[]) |
Wraps a key using the IETF RFC 5649 AES Key Wrap with Padding algorithm. (Inherited from Aes) |
| EncryptKeyWrapPadded(ReadOnlySpan<Byte>, Span<Byte>) |
Wraps a key using the IETF RFC 5649 AES Key Wrap with Padding algorithm, writing the result to a specified buffer. (Inherited from Aes) |
| EncryptKeyWrapPadded(ReadOnlySpan<Byte>) |
Wraps a key using the IETF RFC 5649 AES Key Wrap with Padding algorithm. (Inherited from Aes) |
| EncryptKeyWrapPaddedCore(ReadOnlySpan<Byte>, Span<Byte>) |
Wraps a key using the IETF RFC 5649 AES Key Wrap with Padding algorithm, writing the result to a specified buffer. (Inherited from Aes) |
| Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
| GenerateIV() |
Generates a random initialization vector (IV) to use for the AES algorithm. |
| GenerateKey() |
Generates a random key to use for the AES algorithm. |
| GetCiphertextLengthCbc(Int32, PaddingMode) |
Gets the length of a ciphertext with a given padding mode and plaintext length in CBC mode. (Inherited from SymmetricAlgorithm) |
| GetCiphertextLengthCfb(Int32, PaddingMode, Int32) |
Gets the length of a ciphertext with a given padding mode and plaintext length in CFB mode. (Inherited from SymmetricAlgorithm) |
| GetCiphertextLengthEcb(Int32, PaddingMode) |
Gets the length of a ciphertext with a given padding mode and plaintext length in ECB mode. (Inherited from SymmetricAlgorithm) |
| GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
| GetType() |
Gets the Type of the current instance. (Inherited from Object) |
| MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
| SetKey(ReadOnlySpan<Byte>) |
Sets the key for this instance. (Inherited from SymmetricAlgorithm) |
| SetKeyCore(ReadOnlySpan<Byte>) |
Sets the key for this instance. (Inherited from SymmetricAlgorithm) |
| ToString() |
Returns a string that represents the current object. (Inherited from Object) |
| TryDecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode) |
Attempts to decrypt data into the specified buffer, using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) |
When overridden in a derived class, attempts to decrypt data into the specified buffer, using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| TryDecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode, Int32) |
Attempts to decrypt data into the specified buffer, using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| TryDecryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32) |
When overridden in a derived class, attempts to decrypt data into the specified buffer, using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| TryDecryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) |
Attempts to decrypt data into the specified buffer, using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| TryDecryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) |
When overridden in a derived class, attempts to decrypt data into the specified buffer, using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| TryDecryptKeyWrapPadded(ReadOnlySpan<Byte>, Span<Byte>, Int32) |
Attempts to unwrap a key that was wrapped using the IETF RFC 5649 AES Key Wrap with Padding algorithm. (Inherited from Aes) |
| TryEncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode) |
Attempts to encrypt data into the specified buffer, using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| TryEncryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) |
When overridden in a derived class, attempts to encrypt data into the specified buffer, using CBC mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| TryEncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode, Int32) |
Attempts to encrypt data into the specified buffer, using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| TryEncryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32) |
When overridden in a derived class, attempts to encrypt data into the specified buffer, using CFB mode with the specified padding mode and feedback size. (Inherited from SymmetricAlgorithm) |
| TryEncryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) |
Attempts to encrypt data into the specified buffer, using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| TryEncryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) |
When overridden in a derived class, attempts to encrypt data into the specified buffer, using ECB mode with the specified padding mode. (Inherited from SymmetricAlgorithm) |
| ValidKeySize(Int32) |
Determines whether the specified key size is valid for the current algorithm. (Inherited from SymmetricAlgorithm) |
Applies to
Feedback
Was this page helpful?
