OpenSSL CocoaPods, Carthage and Swift Package Manager package for iOS and macOS. Complete solution to OpenSSL on iOS and macOS. Package comes with precompiled libraries, and includes a script to build newer versions if necessary.
Current version contains binaries built with latest iOS SDK (target 7.0), and latest macOS SDK (target 10.10) for all supported architectures (including macOS Catalyst).
It takes some time to keep it all for your convenience, so maybe spare $1, so I can keep working on that. There are more than 8000 clones daily. If I’d get $1/month from each company that uses my work here, I’d say we’re even. Hurry up, find the Sponsorship button, and fulfill your duty.
Apple says: “Although OpenSSL is commonly used in the open source community, OpenSSL does not provide a stable API from version to version. For this reason, although OS X provides OpenSSL libraries, the OpenSSL libraries in OS X are deprecated, and OpenSSL has never been provided as part of iOS.”
You don’t have to use pre-built binaries I provide. You can build it locally on your trusted machine.
$ git clone https://github.com/krzyzanowskim/OpenSSL.git $ cd OpenSSL $ make
The result of a build process is put inside Frameworks directory.
OpenSSL.xcframework (Used by the Swift Package Manager package integration) won’t load properly in your app if the app uses Sign to Run Locally Signing Certificate with Hardened Runtime enabled. It is possible to setup Xcode like this. To solve the problem you have two options:
Disable Library Validationaka
dependencies: [ .package(url: "https://github.com/krzyzanowskim/OpenSSL.git", .upToNextMinor(from: "1.1.180")) ]
These libraries work for both iOS and macOS. There are two OpenSSL static libraries;
libssl.a Do NOT expect these OpenSSL files to work on every CPU architecture in the world. It is your prerogative to check. Ask yourself, are you trying to write an app for old devices? new devices only? all iOS devices? only macOS?, etc ::
The OpenSSL-Universal Framework is a Fat Binary. That means it supports multiple CPU architectures in a single file. To understand this, return to
Terminal. Navigate to your OpenSSL-Universal macOS files and run the command
file libcrypto.a This will tell you architecture the file is compiled against
x86_64. If you tried the iOS OpenSSL-Universal files it would have said
arm64 + Simulators (
You want to ensure Xcode knows;
Link Binary With Libraries. Select
+and navigate to the static OpenSSL libraries that was included in the framework. The magical result was, your
Library Search Pathswere populated without you typing anything. Now go to the Target. In
Build Settingsset the
Always Search User Pathsto
Yes. Then add a new entry to the
User Header Search Paths. This should be the location of the OpenSSL header files that were included in OpenSSLUniversal.