CryptoPro / corefx

This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others. We welcome contributions.
https://github.com/dotnet/core
MIT License
27 stars 7 forks source link

EnvelopedCms.Decode throws an exception #25

Closed AlexeyAKat closed 2 years ago

AlexeyAKat commented 4 years ago

The following test code works on Windows and throws an exception on linux:

var envelopedCms = new EnvelopedCms();

// throws an exception
envelopedCms.Decode(msg);

Exception stack trace:

Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Unknown error (0x0)
   at Internal.Cryptography.Pal.Windows.HelpersWindows.GetMsgParamAsMemory(SafeCryptMsgHandle hCryptMsg, CryptMsgParamType paramType, Int32 index)
   at Internal.Cryptography.Pal.Windows.DecryptorPalWindows.Decode(Byte[] encodedMessage, Int32& version, ContentInfo& contentInfo, AlgorithmIdentifier& contentEncryptionAlgorithm, X509Certificate2Collection& originatorCerts, CryptographicAttributeObjectCollection& unprotectedAttributes)
   at Internal.Cryptography.Pal.Windows.PkcsPalWindows.Decode(Byte[] encodedMessage, Int32& version, ContentInfo& contentInfo, AlgorithmIdentifier& contentEncryptionAlgorithm, X509Certificate2Collection& originatorCerts, CryptographicAttributeObjectCollection& unprotectedAttributes)
   at System.Security.Cryptography.Pkcs.EnvelopedCms.Decode(Byte[] encodedMessage)

OS: Ubuntu 18.04.4 LTS, .net core 3.1 (SDK 3.1.202, runtime 3.1.4), Crypto-Pro CSP 5.0.11732 KC1, instruction Linux.md was used, corefx ver.3.1.1.241 (4.7.0-dev.20175.1) from link .

Fasjeit commented 2 years ago

Основная работа по поддержке CMS шифрования тут: https://github.com/CryptoPro/corefx/issues/56