CryptoProvider.BlockSize Property


Gets the cipher block size, in bytes.

Namespace:   System.Security.RightsManagement
Assembly:  WindowsBase (in WindowsBase.dll)

public int BlockSize { get; }

Property Value

Type: System.Int32

The cipher block size, in bytes. The default block size for Advanced Encryption Standard (AES) is 8.

The clearText and cipherText buffers passed to Encrypt and Decrypt must be n*BlockSize bytes in length, where 'n' is an integer greater than or equal to 1.

If CanMergeBlocks is false, buffers passed to Encrypt must be the same length as the buffers passed to Decrypt.

If CanMergeBlocks is true, buffers passed to Encrypt can be a different length from the buffers passed to Decrypt (all buffer sizes must still always be a multiple of BlockSize bytes in length).

A BlockSize of 1 indicates that the cipher is a stream cipher; a BlockSize of 2 or greater indicates a block cipher.

Legacy Code Example

The following example shows how to use the BlockSize property in converting clear-text data to encrypted-text data.

Code snippet is not found. Confirm that the code snippet name 'RightsManagedContentPublish' is correct.

.NET Framework
Available since 3.0
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft