A Swift library for RSA key generation, encryption/decryption, signing/verification, and other cryptographic operations using CommonCrypto.
SwCrypt is a Swift library that provides a comprehensive suite of cryptographic functions for iOS and macOS development. It enables developers to perform RSA key generation, encryption/decryption, digital signing, AES symmetric encryption, elliptic curve operations, and secure key storage using Apple's CommonCrypto framework. The library solves the problem of accessing CommonCrypto's low-level C APIs from Swift by offering a clean, type-safe interface.
iOS and macOS developers who need to implement encryption, digital signatures, key management, or other cryptographic operations in their Swift applications, particularly those working on security-sensitive apps like messaging, finance, or data protection tools.
Developers choose SwCrypt because it provides a complete, well-tested Swift wrapper for CommonCrypto with support for modern cryptographic standards (RSA-PSS, AES-GCM, elliptic curves) while maintaining OpenSSL compatibility for key formats. Its simple API and availability checking make it more accessible than dealing with CommonCrypto directly.
RSA public/private key generation, RSA, AES encryption/decryption, RSA sign/verify in Swift with CommonCrypto in iOS and OS X
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
SwCrypt wraps a wide range of CommonCrypto functions, including RSA, AES, elliptic curves, Diffie-Hellman, and HMAC, as shown in the README's extensive code examples for encryption, signing, and key derivation.
It provides a clean, type-safe Swift API that simplifies access to low-level CommonCrypto C APIs, reducing the need for complex bridging or unsafe pointer handling.
The library supports converting between DER and PEM formats and encrypting/decrypting private keys with OpenSSL compatibility, making it easy to interoperate with existing systems.
Includes SwKeyStore functions to securely upsert, retrieve, and delete keys from the iOS/macOS Keychain with configurable accessibility options, streamlining secure key management.
SwCrypt is tightly coupled to Apple's CommonCrypto framework, making it unusable on non-Apple platforms like Linux or Windows, which limits cross-platform development.
Developers must manually check function availability using dlopen/dlsym before use, as noted in the README, adding boilerplate code and potential runtime errors.
The README primarily offers code snippets without detailed explanations, best practices, or error handling guides, which can hinder learning and debugging.