Skip to content

Apple

On Apple platforms, the library provides two provider implementations:

  • CryptoKit – the modern, preferred provider via CryptoKit
  • CommonCrypto – the legacy fallback via CommonCrypto

Non-default Xcode location

The CryptoKit provider requires Swift and links against Swift libraries shipped with Xcode. If Xcode is not installed at /Applications/Xcode.app (e.g. you use multiple Xcode versions or a tool like xcodes), you may see linker errors at build time. See Xcode / Swift compatibility for how to fix this.

Using in your projects

dependencies {
    // for cryptokit
    implementation("dev.whyoleg.cryptography:cryptography-provider-cryptokit:0.6.0")
    // for commoncrypto
    implementation("dev.whyoleg.cryptography:cryptography-provider-apple:0.6.0")
}

Access via CryptographyProvider.CryptoKit and CryptographyProvider.Apple correspondingly (available on iOS, macOS, watchOS, tvOS).


See the algorithm support tables for specific limitations and Working with Keys for key format restrictions.