Latest 1.0.2
License Apache 2.0
Platforms ios 9.3

DRACOON Swift Crypto SDK

A library which implements the client-side encryption of DRACOON.


A detailed description of client-side encryption of DRACOON can be found here:


Minimum Requirements

Xcode 7.3.1 or newer

Build boringSSL



Add the SDK to your Cartfile:

github "dracoon/dracoon-swift-crypto-sdk.git" ~> 1.0.2

Then run

carthage update --platform iOS

To add the framework to your project, open it in Xcode, choose the "General" tab in targets settings and add it to "Linked Frameworks and Libraries".


Add to your Podfile:

source ''
platform :ios, '9.3'

target '<Your Target Name>' do
pod 'DRACOON-Crypto-SDK', '~> v1.0.2'

Then run

pod install

Build examples

There is an example app in build_examples.

Run sh and sh
The run sh regenerateProjects to generate both the example projects.

To run the Carthage project open CryptoSDKCarthageExample.xcodeproj
To run the CocoaPods project open CryptoSDKCocoaPodsExample.xcworkspace


An example playground can be found here: Example/CryptoSDK.playground

The example shows the complete encryption workflow, i.e. generate user keypair, validate user
keypair, generate file key, encrypt file key, and finally encrypt and decrypt a file.

    // --- INITIALIZATION ---
    let crypto = Crypto()
    // Generate key pair
    let userKeyPair = try crypto.generateUserKeyPair(password: USER_PASSWORD)
    // Check key pair
    if !crypto.checkUserKeyPair(keyPair: userKeyPair, password: USER_PASSWORD) {

    let plainData = .utf8)


    // --- ENCRYPTION ---
    // Generate plain file key
    let plainFileKey = try crypto.generateFileKey()
    // Encrypt blocks
    let encryptionCipher = try crypto.createEncryptionCipher(fileKey: fileKey)
    let encData = try encryptionCipher.processBlock(fileData: plainData)
    try encryptionCipher.doFinal()
    // Encrypt file key
    let encryptedKey = try crypto.encryptFileKey(fileKey: plainFileKey, publicKey: userKeyPair.publicKeyContainer)


    // --- DECRYPTION ---
    // Decrypt file key
    let decryptedKey = try crypto.decryptFileKey(fileKey: encryptedKey, privateKey: userKeyPair.privateKeyContainer,
    // Decrypt blocks
    let decryptionCipher = try crypto.createDecryptionCipher(fileKey: fileKey)
    let decData = try decryptionCipher.processBlock(fileData: encData)
    try decryptionCipher.doFinal()


Copyright and License


Latest podspec

    "name": "DRACOON-Crypto-SDK",
    "version": "1.0.2",
    "summary": "Official DRACOON Crypto SDK",
    "description": "This SDK implements client-side encryption for DRACOON.",
    "homepage": "",
    "license": {
        "type": "Apache 2.0",
        "file": "LICENSE"
    "authors": {
        "Mathias Schreiner": "[email protected]"
    "source": {
        "git": "",
        "tag": "v1.0.2"
    "module_name": "crypto_sdk",
    "platforms": {
        "ios": "9.3"
    "swift_version": "4.2",
    "source_files": "crypto-sdk/**/*",
    "vendored_frameworks": "OpenSSL/openssl.framework"

Pin It on Pinterest

Share This