在我的專案中,我的日志檔案中經常出現與“密碼學”相關的錯誤。細節:
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>
我試圖解決并找到該問題的解決方案,但我沒有找到任何類似問題的問題。
我不知道該向誰尋求有關此主題的建議。請幫助我
謝謝!
uj5u.com熱心網友回復:
關于類initialization vector (IV)和存在RijndaelManaged 類的錯誤意味著您的 WCF 服務正在使用一種 AES 加密形式。
您是否檢查過 WCF 服務是否不在這些不受支持的場景之一下? https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/unsupported-scenarios
符合 FIPS 的 AES 加密在身份級別模擬下的雙工回呼中不起作用。
uj5u.com熱心網友回復:
首先需要確認是否包含相關代碼。如果它包含,您可以參考指定的初始化向量(IV)與此演算法的塊大小不匹配,如果您更改運行 IIS 作業流的用戶帳戶,System.Security.Cryptography.CryptographicException可能會發生。如果是這種情況,您必須授予行程帳戶對包含私鑰的檔案的讀取訪問權限。例如,如果 IIS 作業行程在“Bob”用戶帳戶下運行,則您需要授予“Bob”用戶對包含私鑰的檔案的讀取權限。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/346618.html
