Work with PKCS#7 format using Swift

Hey,


My goal is to work with the PKCS#7 format in an iOS app. In particular I need to be able to do the following operations:

(e.g. RFC5652 standard)

- "SignedData" | Operations: sign, verify

- "EnvelopedData" | Operations: encrypt, decrypt


I am searching for a while now for a way to do all of this in my iOS app using Swift. Are there available libraries in swift or do I have to use an external library like OpenSSL?


Thank you very much


Best regards

Fabian

Ah, CMS. iOS has no CMS API, alas. You will need to either write this code or use a third-party library.

Note that macOS does have a CMS API,

<Security/CMSDecoder.h>
and
<Security/CMSEncoder.h>
, but this is only available on the Mac and not on any iOS-based platforms )-:

If you'd like to see such an API added to iOS in the future, I encourage you to file an enhancement request describing your requirements. While we may have seen similar requests before, a fresh bug report will allow you to express your needs in your own terms, and allow iOS engineering to gauge the level of demand.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I have filed FB7346540 suggesting that the CMS APIs and certain additional security APIs that are all already available on macOS be made available to macOS Catalyst apps. Because the Mac App Store distribution mechanism does not provide a full copy protection mechanim, iOS apps that had no need for these APIs on iOS will have to implement their own solution for copy protection on macOS Catalyst. This problem is much easier to solve on macOS because the APIs are already there - just not available. The macOS security APIs can be reached through a separate plugin bundle compiled for macOS, but a plugin implementation is considerably less secure. It would be much better to make the security APIs directly available to the macOS Catalyst app so that receipt validation could be implemented as part of the code in the main bundle.


Barry

Work with PKCS#7 format using Swift
 
 
Q