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.2' 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.2
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.