# External formats and Swift Crypto

**URL:** <https://forums.swift.org/t/external-formats-and-swift-crypto/33848>\
**Category:** Swift Crypto\
**Created:** [February 15, 2020, 8:12pm UTC](https://forums.swift.org/t/external-formats-and-swift-crypto/33848 "2020-02-15T20:12:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharplet](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sharplet/32/6184_2.png) [@sharplet](https://forums.swift.org/u/sharplet)\
**Post date:** [February 15, 2020, 8:12pm UTC](https://forums.swift.org/t/external-formats-and-swift-crypto/33848/1 "2020-02-15T20:12:49Z")

</div>

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](https://github.com/IBM-Swift/Swift-JWT) package (which does its own ASN.1 parsing internally, implemented in Swift, e.g., in [BlueECC](https://github.com/IBM-Swift/BlueECC/blob/2c4ea97307b28c1338689b4f7a4391a14c0610a4/Sources/CryptorECC/ECPrivateKey.swift)).

On Apple platforms I believe I might be able to cobble together the functionality I need using [SecItemImport](https://developer.apple.com/documentation/security/1395728-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?

---

<div class="post-metadata">

**Author:** ![lukasa](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lukasa/32/1232_2.png) [@lukasa](https://forums.swift.org/u/lukasa)\
**Post date:** [February 15, 2020, 8:54pm UTC](https://forums.swift.org/t/external-formats-and-swift-crypto/33848/2 "2020-02-15T20:54:09Z")

</div>

I believe this is mostly covered by [this request](https://github.com/apple/swift-crypto/issues/27). This is under active discussion right now, we’ll report back soon. 😁
