lextudio/sharpsnmplib

DES decryption issue on .NET Core (3.1 and 5.0) since 12.1.0

GKooijmans opened this issue · 5 comments

I'm seeing a decryption issue with the DES privacy provider that seems to have been introduced in release 12.1.0
No matter what I try I keep getting Malformed Messages after decryption. If I revert back to 12.0.0 the problem disappears without any additional changes. The Triple DES provider doesn't seem to be affected. Tested this on .NET Core 3.1 and 5.0

lextm commented

You have to provide more information regarding the issue.

DESPrivacyProvider.IsSupported should return false on .NET Core 3.1/.NET 5, so you cannot use it to decrypt anything. More hints can be found in https://docs.sharpsnmp.com/tutorials/aes.html#providers-on-bouncy-castle

DESPrivacyProvider.IsSupported has a preprocessor directive that checks the NETSTANDARD2_0 symbol which is not defined when building on .NET 5.0. In which case it always returns true.
The AESPrivacyProviderBase.IsSupported explicitly checks for .NET Core, while the DESPrivacyProvider.IsSupported does not.
I understand you're saying it's not supposed to work on .NET 5, but it does work when using release 12.0.0 of your library (which I enjoy using very much by the way, thank you).

effun commented

You have to provide more information regarding the issue.

DESPrivacyProvider.IsSupported should return false on .NET Core 3.1/.NET 5, so you cannot use it to decrypt anything. More hints can be found in https://docs.sharpsnmp.com/tutorials/aes.html#providers-on-bouncy-castle

After recompile your code on .NET 5 without any change, both DESPrivacyProvider and AesPrivacyProvider work fine. So I guess .NET 5 has everything your project requires. Is it possible to add a framework target for .NET 5 or newer to provide high dotnet version support?

Doesn't this one also fix the issue #146?

Also, please, take note, that this won't work on Windows 7 SP1 (even when net50 is supported there).

lextm commented

Windows 7 reached end of life a while ago, so no longer in scope for this project.