[英]The specified initialization vector (IV) does not match the block size for this algorithm
[英]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.