Something I follow around -
Read, explore, build, break, fix — that’s how I understand.
Last Friday evening, I opened my Notes app to find a password I had saved a while ago. Scrolling through the list, I realized: this isn't ideal. I needed a password manager. Sure, there are plenty out there, but what would I actually learn from that? Might as well build something myself.
I started looking into how to encrypt passwords while only remembering one thing: a Master Password
. The usual stuff came up: public/private keys, key derivation, encryption. Then I came across Shor's algorithm and Post-Quantum Cryptography (PQC), and that sent me straight down the rabbit hole. Two days later, I was deep into quantum-safe encryption, figuring out how to future-proof passwords.
Scrolling and searching around, I found NIST and Open Quantum Safe. Eventually, I landed on liboqs
, but there was a catch - no cross-platform precompiled libraries. I found a few implementations on pub.dev
for Flutter, but they looked way too sketchy.
Taking the hard way
Compiling liboqs
for iOS and the iOS Simulator (for preview) was a hassle, something I usually try to avoid.
Each target required separate architectures: arm64
for my physical iOS device and arm64 + x86_64
for the simulator
Then came the intricacies of cmake
, ninja
and openssl
, and of course, Xcode
being a complete fuck-up in what it does.
Build Process
Setup
OpenSSL
shellgit clone https://github.com/krzyzanowskim/OpenSSL ./openssl
Clone and build
liboqs
shellgit clone https://github.com/open-quantum-safe/liboqs ./liboqs cd ./liboqs
- Build for iOS (arm64)
shellcmake -G Ninja ../ \ -DCMAKE_SYSTEM_NAME=iOS \ -DCMAKE_OSX_ARCHITECTURES="arm64" \ -DCMAKE_OSX_SYSROOT="$(xcrun --sdk iphoneos --show-sdk-path)" \ -DCMAKE_INSTALL_PREFIX=../iphoneos \ -DOQS_DIST_BUILD=ON \ -DOQS_PERMIT_UNSUPPORTED_ARCHITECTURE=ON \ -DOPENSSL_ROOT_DIR=../openssl/iphoneos \ -DOPENSSL_CRYPTO_LIBRARY=../openssl/iphoneos/lib/libcrypto.a \ -DOPENSSL_SSL_LIBRARY=../openssl/iphoneos/lib/libssl.a \ -DOPENSSL_INCLUDE_DIR=../openssl/iphoneos/include ninja ninja install
- Build for iOS Simulator (arm64, x86_64)
shellcmake -G Ninja ../ \ -DCMAKE_SYSTEM_NAME=iOS \ -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ -DCMAKE_OSX_SYSROOT="$(xcrun --sdk iphonesimulator --show-sdk-path)" \ -DCMAKE_INSTALL_PREFIX=../iphonesimulator \ -DOQS_DIST_BUILD=ON \ -DOQS_PERMIT_UNSUPPORTED_ARCHITECTURE=ON \ -DOPENSSL_ROOT_DIR=../openssl/iphonesimulator \ -DOPENSSL_CRYPTO_LIBRARY=../openssl/iphonesimulator/lib/libcrypto.a \ -DOPENSSL_INCLUDE_DIR=../openssl/iphonesimulator/include ninja ninja install
- Create
xcframework
shellxcodebuild -create-xcframework \ -library ./iphoneos/lib/liboqs.a -headers ./iphoneos/include \ -library ./iphonesimulator/lib/liboqs.a -headers ./iphonesimulator/include \ -output ./liboqs.xcframework
Import
liboqs.xcframework
into the app
Once the.xcframework
is created, it can be easily integrated into your app.Create a bridging header:
objective-c#ifndef Bridging_Header_h #define Bridging_Header_h // for swift lang #include <oqs/oqs.h> #endif
Then, specify the Objective-C Bridging Header under
Targets > Your Target > Objective-C Bridging File >$(PROJECT_DIR)/PATH_TO_FOLDER_IF_NESTED/Bridging_Header.h
.
Next Steps
In Part 2, I walk through building a Proof of Concept (POC) app that encrypts and decrypts data using the quantum-safe libraries we set up while also covering the challenges encountered along the way and how they were resolved.