Introduction | SDK Features | Install and configure SDK | Docs | Support
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
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.10+
- 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.2.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/keyknox-x" ~> 0.2.1
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.
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:
- VirgilSDKKeyknox
- VirgilSDK
- VirgilCryptoAPI
- VirgilCryptoApiImpl
- VirgilCrypto
- VSCCrypto
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:
/usr/local/bin/carthage copy-frameworks
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/VirgilCryptoAPIImpl.framework
$(SRCROOT)/Carthage/Build/iOS/VirgilCrypto.framework
$(SRCROOT)/Carthage/Build/iOS/VSCCrypto.framework
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:
- VirgilSDKKeyknox
- VirgilSDK
- VirgilCryptoAPI
- VirgilCryptoApiImpl
- VirgilCrypto
- VSCCrypto
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.
It is possible to use carthage just for fetching the right sources for further integration into your project. Run following command:
$ carthage update --no-build
This will fetch dependencies into a Carthage/Checkouts folder inside your project's folder. Then, drag and drop VirgilCrypto.xcodeproj, VirgilCryptoAPI.xcodeproj, VirgilSDK.xcodeproj and VirgilSDKKeyknox.xcodeproj from corresponding folders inside Carthage/Checkouts folder to your Xcode Project Navigator sidebar.
Next, on your application target's “General” settings tab, in the “Embedded Binaries” section add the following frameworks from subprojects:
- VirgilSDKKeyknox
- VirgilSDK
- VirgilCryptoAPI
- VirgilCryptoApiImpl
- VirgilCrypto
- VSCCrypto
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:
accessTokenProvider
public keys
of all devices/users that should have access to dataprivate key
of current device/useridentity
of 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 [email protected].
Also, get extra help from our support team on Slack.