简体   繁体   English

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

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

I am trying to encrypt the final mdm profile using the Identity certificate(got in the response after SCEP payload). 我正在尝试使用身份证书(在SCEP有效负载后的响应中得到)加密最终的mdm配置文件。 I have the following code: 我有以下代码:

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);

I got the exception: Key length not 128/192/256 bits. 我有一个例外:密钥长度不是128/192/256位。

How can I encrypt the final profile(I am using Bouncy Castle library)? 如何加密最终配置文件(我正在使用Bouncy Castle库)?

Regards 问候

Mag 马格

It seems like your "cerificate.GetPublicKeyString()" is not returning a key with the propper length (128/192/256 bits). 似乎您的“ cerificate.GetPublicKeyString()”未返回具有适当长度(128/192/256位)的键。 The minimum you need is 128 bits (16 bytes = 16 length). 您需要的最小值是128位(16个字节= 16个长度)。

This should not be AES encryption. 这不应该是AES加密。 It has to be CMSAlgorithm.DES_EDE3_CBC encrypted. 它必须是CMSAlgorithm.DES_EDE3_CBC加密的。

暂无
暂无

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

相关问题 对称密钥和初始化矢量是否必须始终为128、192或256位? - Must symmetric keys and initiliazation vectors always be 128, 192, or 256 bits? 在.Net Framework 4.5中,PBKDF2具有128位密钥长度和1,024次SHA256迭代 - PBKDF2 function with 128 Bit Key Length and 1,024 iterations of SHA256 in .Net Framework 4.5 AES(Rijndael)加密128位密钥ecb - AES (Rijndael) Encryption 128 bits key ecb 128位AES和256位AES之间的加密时间差? - Encryption time difference between 128-bits AES and 256-bits AES? IDX10603:算法:“HS256”要求 SecurityKey.KeySize 大于“128”位。 KeySize 报告:'32'。 参数名称:key.KeySize - IDX10603: The algorithm: 'HS256' requires the SecurityKey.KeySize to be greater than '128' bits. KeySize reported: '32'. Parameter name: key.KeySize RijndaelManaged支持128-256位密钥,默认构造函数生成器的密钥大小是多少? - RijndaelManaged supports 128-256 bit key, what key size the default constructor generator? 键“数据源”的值长度超过了“128”的限制 - The value's length for key 'data source' exceeds it's limit of '128' 当使用256位密钥调用aes128密码时,libgcrypt做什么不同? - What is libgcrypt doing different when calling the aes128 cipher with a 256bit key? 识别AES算法。 是AES 128还是AES 256? - Identify AES Algorithm . Is it AES 128 or AES 256? ASP.NET异常:关键“初始目录”的值长度超过了'128'的限制 - ASP.NET exception: The value's length for key 'initial catalog' exceeds it's limit of '128'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM