XstReader
XstReader copied to clipboard
Unhandled Exception: Invalid Cryptographic Message Type
I receive this error when accessing a folder which contains encrypted emails. I didn't receive the error in the original project by Dijji (RIP). The error:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Security.Cryptography.CryptographicException: Invalid cryptographic message type.
at Internal.Cryptography.Pal.Windows.DecryptorPalWindows.Decode(ReadOnlySpan`1 encodedMessage, Int32& version, ContentInfo& contentInfo, AlgorithmIdentifier& contentEncryptionAlgorithm, X509Certificate2Collection& originatorCerts, CryptographicAttributeObjectCollection& unprotectedAttributes)
at Internal.Cryptography.Pal.Windows.PkcsPalWindows.Decode(ReadOnlySpan`1 encodedMessage, Int32& version, ContentInfo& contentInfo, AlgorithmIdentifier& contentEncryptionAlgorithm, X509Certificate2Collection& originatorCerts, CryptographicAttributeObjectCollection& unprotectedAttributes)
at System.Security.Cryptography.Pkcs.EnvelopedCms.Decode(ReadOnlySpan`1 encodedMessage)
at System.Security.Cryptography.Pkcs.EnvelopedCms.Decode(Byte[] encodedMessage)
at XstReader.Common.Crypto.DecryptWithCert(Byte[] encryptedMessageBytes) in C:\Dev\iluvadev\dijji\XstReader\src\XstReader.Api\Common\Crypto.cs:line 133
at XstReader.XstMessage.ReadSignedOrEncryptedMessage(Byte[] messageBytes) in C:\Dev\iluvadev\dijji\XstReader\src\XstReader.Api\XstMessage.cs:line 645
at XstReader.XstMessage.ProcessSignedOrEncrypted() in C:\Dev\iluvadev\dijji\XstReader\src\XstReader.Api\XstMessage.cs:line 631
at XstReader.LTP.ReadTableData[T](TCINFO t, List`1 blocks, List`1 dataBlocks, TCOLDESC[] cols, BTree`1 subNodeTree, TCROWIDUnicode[] indexes, Action`2 idGetter, Action`1 postProcessAction)+MoveNext() in C:\Dev\iluvadev\dijji\XstReader\src\XstReader.Api\LTP.cs:line 582
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length)
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext()
at BrightIdeasSoftware.ObjectListView.BuildList(Boolean shouldPreserveState)
at BrightIdeasSoftware.ObjectListView.SetObjects(IEnumerable collection, Boolean preserveState)
at BrightIdeasSoftware.ObjectListView.set_Objects(IEnumerable value)
at XstReader.App.Controls.XstMessageListControl.SetDataSource(IEnumerable`1 dataSource) in C:\Dev\iluvadev\dijji\XstReader\src\XstReader\Controls\XstMessageListControl.cs:line 102
at XstReader.App.MainForm.SetCurrentXstElement(XstElement value) in C:\Dev\iluvadev\dijji\XstReader\src\XstReader\MainForm.cs:line 55
at XstReader.App.MainForm.set_CurrentXstElement(XstElement value) in C:\Dev\iluvadev\dijji\XstReader\src\XstReader\MainForm.cs:line 45
at XstReader.App.MainForm.<Initialize>b__30_1(Object s, XstElementEventArgs e) in C:\Dev\iluvadev\dijji\XstReader\src\XstReader\MainForm.cs:line 98
at XstReader.App.Controls.XstFolderTreeControl.RaiseSelectedItemChanged() in C:\Dev\iluvadev\dijji\XstReader\src\XstReader\Controls\XstFolderTreeControl.cs:line 43
at XstReader.App.Controls.XstFolderTreeControl.<Initialize>b__1_0(Object s, TreeViewEventArgs e) in C:\Dev\iluvadev\dijji\XstReader\src\XstReader\Controls\XstFolderTreeControl.cs:line 30
at Krypton.Toolkit.KryptonTreeView.OnAfterSelect(TreeViewEventArgs e)
at Krypton.Toolkit.KryptonTreeView.OnTreeViewAfterSelect(Object sender, TreeViewEventArgs e)
at System.Windows.Forms.TreeView.OnAfterSelect(TreeViewEventArgs e)
at System.Windows.Forms.TreeView.TvnSelected(NMTREEVIEW* nmtv)
at System.Windows.Forms.TreeView.WmNotify(Message& m)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
System.Private.CoreLib
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Private.CoreLib.dll
----------------------------------------
XstReader.App
Assembly Version: 2.1.1.0
Win32 Version: 2.1.1
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/XstReader.App.dll
----------------------------------------
System.Runtime
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Runtime.dll
----------------------------------------
System.Text.Encoding.CodePages
Assembly Version: 7.0.0.0
Win32 Version: 7.0.22.51805
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/runtimes/win/lib/net6.0/System.Text.Encoding.CodePages.dll
----------------------------------------
Krypton.Toolkit
Assembly Version: 70.22.11.312
Win32 Version: 70.22.11.312
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/Krypton.Toolkit.dll
----------------------------------------
System.ComponentModel.Primitives
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.ComponentModel.Primitives.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 6.0.2.0
Win32 Version: 6.0.2623.60505
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/System.Windows.Forms.dll
----------------------------------------
System.Windows.Forms.Primitives
Assembly Version: 6.0.2.0
Win32 Version: 6.0.2623.60505
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/System.Windows.Forms.Primitives.dll
----------------------------------------
System.Runtime.InteropServices
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Runtime.InteropServices.dll
----------------------------------------
System.Drawing.Primitives
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Drawing.Primitives.dll
----------------------------------------
System.Collections.Specialized
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Collections.Specialized.dll
----------------------------------------
System.Threading
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Threading.dll
----------------------------------------
System.Diagnostics.TraceSource
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Diagnostics.TraceSource.dll
----------------------------------------
System.Collections
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Collections.dll
----------------------------------------
System.Drawing.Common
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/System.Drawing.Common.dll
----------------------------------------
Microsoft.Win32.SystemEvents
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/Microsoft.Win32.SystemEvents.dll
----------------------------------------
System.ComponentModel.TypeConverter
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.ComponentModel.TypeConverter.dll
----------------------------------------
System.Resources.Extensions
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/System.Resources.Extensions.dll
----------------------------------------
System.Memory
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Memory.dll
----------------------------------------
System.Drawing
Assembly Version: 6.0.2.0
Win32 Version: 6.0.2623.60505
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/System.Drawing.dll
----------------------------------------
System.Threading.Thread
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Threading.Thread.dll
----------------------------------------
System.ComponentModel.EventBasedAsync
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.ComponentModel.EventBasedAsync.dll
----------------------------------------
System.Numerics.Vectors
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Numerics.Vectors.dll
----------------------------------------
System.Collections.Concurrent
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Collections.Concurrent.dll
----------------------------------------
XstReader.App.Common
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/XstReader.App.Common.dll
----------------------------------------
XstReader.Api
Assembly Version: 1.0.7.0
Win32 Version: 1.0.7
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/XstReader.Api.dll
----------------------------------------
netstandard
Assembly Version: 2.1.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/netstandard.dll
----------------------------------------
Microsoft.Win32.Primitives
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/Microsoft.Win32.Primitives.dll
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 6.0.2623.60505
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/Accessibility.dll
----------------------------------------
System.Linq
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Linq.dll
----------------------------------------
System.Console
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Console.dll
----------------------------------------
System.ComponentModel
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.ComponentModel.dll
----------------------------------------
ObjectListView2019Core3
Assembly Version: 2.9.2.0
Win32 Version: 2.9.2
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/ObjectListView2019Core3.dll
----------------------------------------
System.Runtime.Extensions
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Runtime.Extensions.dll
----------------------------------------
System.ObjectModel
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.ObjectModel.dll
----------------------------------------
System.Resources.ResourceManager
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Resources.ResourceManager.dll
----------------------------------------
System.Collections.NonGeneric
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Collections.NonGeneric.dll
----------------------------------------
XstReader.Exporter
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/XstReader.Exporter.dll
----------------------------------------
Krypton.Docking
Assembly Version: 70.22.11.312
Win32 Version: 70.22.11.312
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/Krypton.Docking.dll
----------------------------------------
Krypton.Navigator
Assembly Version: 70.22.11.312
Win32 Version: 70.22.11.312
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/Krypton.Navigator.dll
----------------------------------------
System.Runtime.Loader
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Runtime.Loader.dll
----------------------------------------
System.Diagnostics.Process
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Diagnostics.Process.dll
----------------------------------------
Krypton.Workspace
Assembly Version: 70.22.11.312
Win32 Version: 70.22.11.312
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/Krypton.Workspace.dll
----------------------------------------
System.Xml.ReaderWriter
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Xml.ReaderWriter.dll
----------------------------------------
System.Private.Xml
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Private.Xml.dll
----------------------------------------
System.Text.Encoding.Extensions
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Text.Encoding.Extensions.dll
----------------------------------------
System.Private.Uri
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Private.Uri.dll
----------------------------------------
System.Xml.XmlSerializer
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Xml.XmlSerializer.dll
----------------------------------------
System.Text.RegularExpressions
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Text.RegularExpressions.dll
----------------------------------------
System.Reflection.Emit.ILGeneration
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Reflection.Emit.ILGeneration.dll
----------------------------------------
System.Reflection.Emit
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Reflection.Emit.dll
----------------------------------------
Microsoft.GeneratedCode
Assembly Version: 1.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Private.Xml.dll
----------------------------------------
System.Reflection.Primitives
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Reflection.Primitives.dll
----------------------------------------
System.Threading.ThreadPool
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Threading.ThreadPool.dll
----------------------------------------
System.Runtime.CompilerServices.Unsafe
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Runtime.CompilerServices.Unsafe.dll
----------------------------------------
System.IO.Compression
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.IO.Compression.dll
----------------------------------------
System.Linq.Expressions
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Linq.Expressions.dll
----------------------------------------
Microsoft.CSharp
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/Microsoft.CSharp.dll
----------------------------------------
System.Reflection.Emit.Lightweight
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Reflection.Emit.Lightweight.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
Assembly Version: 0.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Private.CoreLib.dll
----------------------------------------
System.Design
Assembly Version: 6.0.2.0
Win32 Version: 6.0.2623.60505
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/System.Design.dll
----------------------------------------
System.Windows.Forms.Design
Assembly Version: 6.0.2.0
Win32 Version: 6.0.2623.60505
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/6.0.26/System.Windows.Forms.Design.dll
----------------------------------------
System.Security.Cryptography.X509Certificates
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Security.Cryptography.X509Certificates.dll
----------------------------------------
System.Security.Cryptography.Primitives
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Security.Cryptography.Primitives.dll
----------------------------------------
System.Security.Cryptography.Pkcs
Assembly Version: 7.0.0.0
Win32 Version: 7.0.323.6910
CodeBase: file:///C:/Users/stalk/OneDrive/Desktop/XstReader.App.2.1.1/runtimes/win/lib/net6.0/System.Security.Cryptography.Pkcs.dll
----------------------------------------
System.Security.Cryptography.Encoding
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Security.Cryptography.Encoding.dll
----------------------------------------
System.Runtime.Numerics
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Runtime.Numerics.dll
----------------------------------------
System.Diagnostics.StackTrace
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Diagnostics.StackTrace.dll
----------------------------------------
System.Reflection.Metadata
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Reflection.Metadata.dll
----------------------------------------
System.Collections.Immutable
Assembly Version: 6.0.0.0
Win32 Version: 6.0.2623.60508
CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/6.0.26/System.Collections.Immutable.dll
----------------------------------------
************** JIT Debugging **************
Hit this same issue. Opened https://github.com/iluvadev/XstReader/pull/30 that would provide us with an easy workaround by just running the exe with the --suppressCryptoErrors command line flag:
PS C:\your\path\to\the\exe\folder\here> .\XstReader.App.exe --suppressCryptoErrors