【发布时间】:2017-04-16 13:10:27
【问题描述】:
.NET Core 中是否存在 System.Security.Cryptography.Pkcs.SignedCms 类的替代方案?还是我必须像在 WinRT 案例中那样深入研究 BouncyCastle? Is there an alternative of SignedCMS in WinRT?
【问题讨论】:
-
为 BouncyCastle 体验我的朋友做好准备 :)
.NET Core 中是否存在 System.Security.Cryptography.Pkcs.SignedCms 类的替代方案?还是我必须像在 WinRT 案例中那样深入研究 BouncyCastle? Is there an alternative of SignedCMS in WinRT?
【问题讨论】:
不,目前 .NET Core 中没有与 SignedCms 等效的功能。
非常欢迎您在 https://github.com/dotnet/corefx/issues 上创建问题,以表明这是您希望被引入的类型。
【讨论】:
仅供参考,以防万一。似乎可以通过此NUGET 包获得对 SignedCms 和其他 S/MIME 基本 .NET 类的支持:
System.Security.Cryptography.Pkcs
即在我将此 NUGET 包添加到我的 Visual Studio 2017 (VS2017) .NET Core 项目之前,我收到了以下编译错误:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'CmsRecipientCollection' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'X509IssuerSerial' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'EnvelopedCms' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'SignedCms' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'SignerInfoCollection' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'ContentInfo' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'CmsRecipient' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'RecipientInfo' could not be found (are you missing a using directive or an assembly reference?)
Error CS0103 The name 'SubjectIdentifierType' does not exist in the current context
Error CS0246 The type or namespace name 'SignerInfo' could not be found (are you missing a using directive or an assembly reference?)
Error CS1579 foreach statement cannot operate on variables of type 'SignerInfoCollection' because 'SignerInfoCollection' does not contain a public instance definition for 'GetEnumerator'
Error CS0246 The type or namespace name 'CmsSigner' could not be found (are you missing a using directive or an assembly reference?)
添加NUGET包后,我可以编译成功了。
【讨论】: