ExtendedSymmetricAlgorithm Class
Definition
- Namespace
- Bodu.Security.Cryptography
- Assembly
- Bodu.Security.Cryptography.dll
- Package
- Bodu.Security.Cryptography 1.2.0
Serves as the base class for the library's SymmetricAlgorithm implementations that support the extended cipher-mode and padding catalogues (CipherModeKind / PaddingModeKind) beyond the framework CipherMode / PaddingMode enumerations.
public abstract class ExtendedSymmetricAlgorithm : SymmetricAlgorithm, IDisposable
- Inheritance
-
ExtendedSymmetricAlgorithm
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
The framework Mode and Padding properties can only express the members of CipherMode and PaddingMode. This base adds the BlockMode and BlockPadding counterparts over the extended CipherModeKind / PaddingModeKind catalogues (which include, for example, CTR and ISO7816_4) and keeps each pair bidirectionally synchronized: assigning either member of a pair updates the other whenever an equivalent value exists, so consumers inspecting the framework property always observe a consistent configuration.
Transform creation in derived classes reads BlockMode and BlockPadding, so both the framework properties and the extended properties are honoured regardless of which surface the caller configures.
Constructors
ExtendedSymmetricAlgorithm()
Initializes a new instance of the ExtendedSymmetricAlgorithm class.
protected ExtendedSymmetricAlgorithm()
Properties
BlockMode
Gets or sets the block cipher mode of operation used when creating encryptors and decryptors.
public CipherModeKind BlockMode { get; set; }
Property Value
- CipherModeKind
One of the CipherModeKind values. The default is CBC.
Remarks
This property replaces the inherited Mode property for use with BlockCipherModeFactory and the extended set of modes it supports, including CTR and OFB, which are not available via the standard CipherMode enumeration.
When the assigned value has a matching member in CipherMode (for example, CBC, ECB, CFB), the inherited Mode is kept in sync so that consumers inspecting the base property observe a consistent mode. Extended modes with no CipherMode equivalent leave the base property unchanged.
BlockPadding
Gets or sets the extended padding mode used when creating encryptors and decryptors.
public PaddingModeKind BlockPadding { get; set; }
Property Value
- PaddingModeKind
One of the PaddingModeKind values. The default is PKCS7.
Remarks
When the assigned value has a matching member in PaddingMode (for example, PKCS7, Zeros, None), the inherited Padding is kept in sync. Extended modes with no PaddingMode equivalent (such as ISO7816_4) leave the base property unchanged.
Mode
Gets or sets the mode for operation of the symmetric algorithm.
public override CipherMode Mode { get; set; }
Property Value
- CipherMode
The mode for operation of the symmetric algorithm. The default is CBC.
Remarks
Also synchronizes BlockMode so that encryptor and decryptor creation, which read BlockMode, honour the assigned value. Every CipherMode member has a matching CipherModeKind member, so the synchronization always succeeds.
Exceptions
- CryptographicException
The cipher mode is not one of the CipherMode values.
Padding
Gets or sets the padding mode used in the symmetric algorithm.
public override PaddingMode Padding { get; set; }
Property Value
- PaddingMode
The padding mode used in the symmetric algorithm. The default is PKCS7.
Remarks
Also synchronizes BlockPadding when the assigned value has a matching member in PaddingModeKind.
Exceptions
- CryptographicException
The padding mode is not one of the PaddingMode values.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |