繁体   English   中英

密钥长度不是128/192/256位

[英]Key length not 128/192/256 bits

我正在尝试使用身份证书(在SCEP有效负载后的响应中得到)加密最终的mdm配置文件。 我有以下代码:

context.Request.InputStream.CopyTo(deviceResponse);

  var signer = new SignedCms();
  signer.Decode(deviceResponse.ToArray());
  X509Certificate2 certificate = signer.Certificates[0];
  string str= sonething; //my final configuraton profile                       
 encryptedProfile = AESEncryption(str, cerificate.GetPublicKeyString(), true, Encoding.Default, pkcs);

我有一个例外:密钥长度不是128/192/256位。

如何加密最终配置文件(我正在使用Bouncy Castle库)?

问候

马格

似乎您的“ cerificate.GetPublicKeyString()”未返回具有适当长度(128/192/256位)的键。 您需要的最小值是128位(16个字节= 16个长度)。

这不应该是AES加密。 它必须是CMSAlgorithm.DES_EDE3_CBC加密的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM