SymmetricAlgorithm GenerateKey with 128 bit

392 Views Asked by At

I have the following code to create a new SymmetricAlgorithm:

internal static SymmetricAlgorithm CreateSymmetricAlgorithm()
{
    var algorithm = new RijndaelManaged
    {
        KeySize = 128,
        Padding = PaddingMode.ISO10126,
        Mode = CipherMode.CBC
    };
    return algorithm;
}

I use the code like:

var algorithm = SymmetricHelper.CreateSymmetricAlgorithm();
var key = algorithm.GenerateKey();

But the generated-key-size is just 16 Byte.

Why I don't get a Key with 128-Bit?

1

There are 1 best solutions below

0
On BEST ANSWER

16 bytes is 128 bit, 16 * 8 = 128.