Virgil KeyKnox Objective-C/Swift SDK
Virgil Security provides an SDK which allows you to communicate with Virgil Keyknox Service. Virgil Keyknox Service allows users to store their sensitive data (such as Private Key) encrypted (with end-to-end encryption) for using and sharing it between different devices.
- use Virgil Crypto library
- use Virgil SDK
- upload encrypted sensitive data to Virgil Keyknox Service
- download the data from Virgil Keyknox Service
- update and synchronize the data
Install and configure SDK
Virgil Keyknox SDK is provided as a set of frameworks. These frameworks are distributed via Carthage and CocoaPods. Also in this guide, you find one more package called VirgilCrypto (Virgil Crypto Library) that is used by the SDK to perform cryptographic operations.
Frameworks are available for:
- iOS 9.0+
- macOS 10.11+
- tvOS 9.0+
- watchOS 2.0+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate Virgil Keyknox into your Xcode project using CocoaPods, specify it in your Podfile:
target '<Your Target Name>' do use_frameworks! pod 'VirgilSDKKeyknox', '~> 0.4.1' end
Then, run the following command:
$ pod install
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update $ brew install carthage
To integrate Virgil Keyknox into your Xcode project using Carthage, create an empty file with name Cartfile in your project's root folder and add following lines to your Cartfile
github "VirgilSecurity/virgil-keyknox-x" ~> 0.4.1
Linking against prebuilt binaries
To link prebuilt frameworks to your app, run following command:
$ carthage update
This will build each dependency or download a pre-compiled framework from github Releases.
Building for iOS/tvOS/watchOS
On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, add following frameworks from the Carthage/Build folder inside your project's folder:
On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase.” Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
$(SRCROOT)/Carthage/Build/iOS/VirgilSDKKeyknox.framework $(SRCROOT)/Carthage/Build/iOS/VirgilSDK.framework $(SRCROOT)/Carthage/Build/iOS/VirgilCryptoAPI.framework $(SRCROOT)/Carthage/Build/iOS/VirgilCrypto.framework $(SRCROOT)/Carthage/Build/iOS/VirgilCryptoFoundation.framework $(SRCROOT)/Carthage/Build/iOS/VSCCommon.framework $(SRCROOT)/Carthage/Build/iOS/VSCFoundation.framework
Building for macOS
On your application target's “General” settings tab, in the “Embedded Binaries” section, drag and drop following frameworks from the Carthage/Build folder on disk:
Additionally, you'll need to copy debug symbols for debugging and crash reporting on macOS.
On your application target’s “Build Phases” settings tab, click the “+” icon and choose “New Copy Files Phase”. Click the “Destination” drop-down menu and select “Products Directory”. For each framework, drag and drop corresponding dSYM file.
To begin using Virgil Keyknox SDK you'll need to initialize
SyncKeyStorage class. This class is responsible for synchronization between Keychain and Keyknox Cloud.
In order to initialize
SyncKeyStorage class you'll need the following values:
public keysof all devices/users that should have access to data
private keyof current device/user
identityof the user (the device can have different users)
import VirgilSDK import VirgilSDKKeyknox // Setup Access Token provider to provide access token for Virgil services // Check https://github.com/VirgilSecurity/virgil-sdk-x let accessTokenProvider = "" // Download public keys of users that should have access to data from Virgil Cards service // Check https://github.com/VirgilSecurity/virgil-sdk-x let publicKeys =  // Load private key from Keychain let privateKey = "" let syncKeyStorage = SyncKeyStorage(identity: "Alice", accessTokenProvider: accessTokenProvider, publicKeys: publicKeys, privateKey: privateKey)
Virgil Security has a powerful set of APIs, and the documentation below can get you started today.
This library is released under the 3-clause BSD License.
Our developer support team is here to help you. Find out more information on our Help Center.
You can find us on Twitter or send us email support@VirgilSecurity.com.
Also, get extra help from our support team on Slack.
Help us keep the lights on
0.4.1 - Apr 10, 2019
- Increased macOS minimum deployment target to 10.11
- Migrated to Xcode 10.2 and Swift 5.0
0.4.0 - Mar 20, 2019
- Switch to new crypto v5. Check README for updates on how to setup project!
0.3.0 - Jan 17, 2019
- SyncKeyStorage.makeLocalStorage method to manage keys without connecting to Cloud
- Replaced KeychainStorageWrapper to VirgilSDK.SandboxedKeychainStorage
- Changed dependency management inside xcodeproject
0.2.1 - Oct 26, 2018
- Changed Podspec name from VirgilKeyknox to VirgilSDKKeyknox
0.2.0 - Oct 11, 2018
- Migrated to Xcode 10 / Swift 4.2
- Added gh-pages docs
- Small fixes