Reputation: 2117
I'm encrypting some data using TripleDES
and three different modes (CBC
, CFB
and OFB
) like this:
using (TripleDES alg = TripleDES.Create())
{
var param = GetParams();
alg.KeySize = param.keySize;
alg.BlockSize = param.blockSize;
alg.Key = param.sessionKey;
alg.IV = param.IV;
alg.Mode = param.mode;
using (ICryptoTransform encryptor = alg.CreateEncryptor(alg.Key, alg.IV))
The last line throws an exception (Specified cipher mode is not valid for this algorithm.
) whenever I use CFB
or OFB
as the mode.
Is there anything I'm doing wrong?
Upvotes: 0
Views: 158
Reputation: 525
Basically because it is not supported by .Net Core. See https://github.com/dotnet/runtime/pull/38211
Except if you are working on a legacy code, you should use AES instead of 3DES.
Upvotes: 1