我正在使用TripleDES和三种不同的模式(CBC,CFB和OFB)加密一些数据,如下所示:
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))当我使用CFB或OFB作为模式时,最后一行抛出一个异常(Specified cipher mode is not valid for this algorithm.)。
我有什么地方做错了吗?
发布于 2021-06-23 01:30:04
基本上是因为.Net内核不支持它。请参阅https://github.com/dotnet/runtime/pull/38211
除非您正在处理旧代码,否则应使用AES而不是3DES。
https://stackoverflow.com/questions/68066133
复制相似问题