Swift Crypto, a new open-source project for the Swift ecosystem was announced several days ago.
“I’m thrilled to announce a new open-source project for the Swift ecosystem, Swift Crypto. Swift Crypto is a new Swift package that brings the fantastic APIs of Apple CryptoKit to the wider Swift community. This will allow Swift developers, regardless of the platform on which they deploy their applications, to access these APIs for a common set of cryptographic operations”, wrote Cori Benfield in the official Swift Blog. He is a member of a team developing foundational server-side Swift libraries as part of Apple‘s Cloud Services division, and is a core developer on SwiftNIO.
This new open-source library provides a cross-platform solution for using the CryptoKit APIs on all platforms supported by Swift. This means that on all the supported platforms you can now simply write:
to get all of the CryptoKit APIs.
Swift Crypto is created to be easy to use and to help developers in using cryptographic functions.
“On Apple platforms, Swift Crypto defers directly to CryptoKit, while on all other platforms it uses a brand-new implementation built on top of the BoringSSL library. This gives Swift users easy access to a set of easy to use, safe cryptographic APIs on all platforms, and is an extremely useful tool when writing cross platform cryptographic code”, explained Cori Benfield.
At the same time Swift Crypto aims to provide the same level of effectiveness on every one of the supported platforms. According to Cory Benfield, “it is simply unacceptable for the same inputs to the same API to produce semantically different results when using Swift Crypto and when using Apple CryptoKit”.
The package can be installed anywhere Swift is supported. That makes it easier for developers to write safe cross-platform or server side applications in Swift.
In fact, the new open-source project is a semantically versioned Swift package. Swift Crypto is made available under the Apache 2.0 license that makes it easy and reliable to use absolutely everywhere.
If you are passionate about open-source, the source of Swift Crypto is available.