繁体   English   中英

连接 WCF Cryptography.CryptographicException:指定的初始化向量 (IV) 与此算法的块大小不匹配

[英]Connect WCF Cryptography.CryptographicException: Specified initialization vector (IV) does not match the block size for this algorithm

在我的项目中,我的日志文件中经常出现与“密码学”相关的错误。 细节:

Global.aspx:  - System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Security.Cryptography.CryptographicException: Specified initialization vector (IV) does not match the block size for this algorithm.
   at System.Security.Cryptography.RijndaelManagedTransform..ctor(Byte[] rgbKey, CipherMode mode, Byte[] rgbIV, Int32 blockSize, Int32 feedbackSize, PaddingMode PaddingValue, RijndaelManagedTransformMode transformMode)
   at System.Security.Cryptography.RijndaelManaged.NewEncryptor(Byte[] rgbKey, CipherMode mode, Byte[] rgbIV, Int32 feedbackSize, RijndaelManagedTransformMode encryptMode)

但实际上,在我的项目中,我找不到任何与此相关的代码语句。 除了当我将我的项目与 WCF 服务连接时,Visual Studio 会自动生成一些语句

详细信息:./MyProject/Connected Services/WCFServiceName/configuaration91.svcinfo

        <property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <serializedValue>My</serializedValue>
        </property>
        <property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <serializedValue>LocalMachine</serializedValue>
        </property>
        <property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <serializedValue>FindBySubjectDistinguishedName</serializedValue>
        </property>

我试图解决并找到该问题的解决方案,但我没有找到任何类似问题的问题。

我不知道该向谁寻求有关此主题的建议。 请帮助我

谢谢!

关于initialization vector (IV)的错误和RijndaelManaged 的存在意味着您的 WCF 服务正在使用一种 AES 加密形式。

您是否检查过 WCF 服务是否不在这些不受支持的场景之一下? https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/unsupported-scenarios

符合 FIPS 的 AES 加密在身份级别模拟下的双工回调中不起作用。

首先需要确认是否包含相关代码。 如果包含,您可以参考指定的初始化向量(IV)与此算法的块大小不匹配,如果您更改运行 IIS 工作流的用户帐户,则可能会出现 System.Security.Cryptography.CryptographicException。 如果是这种情况,您必须授予进程帐户对包含私钥的文件的读取访问权限。 例如,如果 IIS 工作进程在 Bob 帐户下运行,则您需要授予 Bob 对包含私钥的文件的读取权限。

暂无
暂无

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

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