首页 > 解决方案 > 在 IOS 上使用加密消息语法服务创建 PKCS7/CMS

问题描述

我需要创建一个 PKCS7/CMS 以在 Swift 中输入 Web 服务。

在 Android 中,我们使用了 'spongycastle' https://www.bouncycastle.org/docs/pkixdocs1.4/org/bouncycastle/cms/CMSSignedData.html但找不到 Swift 或 Objective C 的示例或解决方案。

搜索了 Apple 的文档:https ://developer.apple.com/documentation/security/cryptographic_message_syntax_services#1677736但找不到任何特殊的本地或第三方支持。

问了苹果技术支持,他们说IOS还不支持:https ://developer.apple.com/forums/thread/681717

根据Apple文档,应该使用以下函数,但是类和函数的内容应该是什么,如何使用它们来实现PKCS7/CMS Signature?

func CMSEncoderCreate(_ cmsEncoderOut: UnsafeMutablePointer<CMSEncoder?>) -> OSStatus {
    return
}

func CMSEncoderUpdateContent(_ cmsEncoder: CMSEncoder,
                           _ content: UnsafeRawPointer,
                           _ contentLen: Int) -> OSStatus {
    return
}

func CMSEncoderCopyEncodedContent(_ cmsEncoder: CMSEncoder,
                                  _ encodedContentOut: UnsafeMutablePointer<CFData?>) -> OSStatus {
    return
}

有没有人有使用 Swift 或目标 C 代码的特定解决方案来执行此操作的经验?

标签: iosswiftcryptographydigital-signaturepkcs#7

解决方案


推荐阅读