Cryptographic Message Syntax Services for swift

In Swift, I need to create a CMS to input a web service.

In Android we used 'spongycastle' https://www.bouncycastle.org/docs/pkixdocs1.4/org/bouncycastle/cms/CMSSignedData.html But I did not find a sample or solution for Swift or objective C.

I also read Apple related documents https://developer.apple.com/documentation/security/cryptographic_message_syntax_services#1677736 , but still nothing special.

Does anyone have experience working with a specific solution for Swift or objective C code to do this?

thank you.

Accepted Reply

iOS-based platform (iPhone)

OK.

That means that you won’t be able to use the CMSEncoder API because it’s not available on iOS. Indeed, the iOS SDK has no CMS support )-: You’ll have to write, or acquire, your own library for this.

With regards available open source CMS libraries, I’ve not used any of them and thus don’t have a specific recommendation.

Oh, there is one easier option: If you have any control over the web service you’re using, you could change it to not require CMS.

Regardless of what you choose to do here, I’d appreciate you filing an enhancement request for a well-supported CMS API. CMS is a fundamental crypto format and it’s sad that we don’t support it.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Replies

In Swift, I need to create a CMS to input a web service.

Which Apple platform are you working on? macOS? Or one of the iOS-based platforms?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Hi

    iOS-based platform (iPhone)

Add a Comment

iOS-based platform (iPhone)

OK.

That means that you won’t be able to use the CMSEncoder API because it’s not available on iOS. Indeed, the iOS SDK has no CMS support )-: You’ll have to write, or acquire, your own library for this.

With regards available open source CMS libraries, I’ve not used any of them and thus don’t have a specific recommendation.

Oh, there is one easier option: If you have any control over the web service you’re using, you could change it to not require CMS.

Regardless of what you choose to do here, I’d appreciate you filing an enhancement request for a well-supported CMS API. CMS is a fundamental crypto format and it’s sad that we don’t support it.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Is it still the case CMS is not supported in apple native?

I see this https://developer.apple.com/documentation/security/cryptographic_message_syntax_services#1677755

Is it still the case CMS is not supported in apple native?

That’s correct.

The only thing that’s change here is this:

With regards available open source CMS libraries, I’ve not used any of them and thus don’t have a specific recommendation.

These days I’m a big fan of Swift Certificates and Swift ASN.1. I’m not sure if they support CMS out of the box but, if not, it should be feasible to build that support on the primitive they provide.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"