External formats and Swift Crypto

First of all, I love the Swift Crypto exists and am very excited about having modern cryptographic tools available on all platforms.

I started experimenting with using the library for working with JWTs, but quickly ran into the problem of working with existing keys in various external formats. I did a bunch of digging on various sources like Apple’s Security.framework documentation and developer forums, and ultimately realised that Swift Crypto doesn’t really have native support for these formats and that a good implementation would probably include something like a generalised ASN.1 parser. This is way beyond the scope of what I need, so for now I’m using IBM’s SwiftJWT package (which does its own ASN.1 parsing internally, implemented in Swift, e.g., in BlueECC).

On Apple platforms I believe I might be able to cobble together the functionality I need using SecItemImport (which so far seems to be the only API with knowledge of these external formats).

This seems like a natural extension to what’s currently in Swift Crypto. Do you agree? What would be the next step for making that happen?

I believe this is mostly covered by this request. This is under active discussion right now, we’ll report back soon. :grin:

1 Like