Git Product home page Git Product logo

nau11713 / e3kit-x Goto Github PK

View Code? Open in Web Editor NEW

This project forked from virgilsecurity/virgil-e3kit-x

0.0 1.0 0.0 145 KB

E3Kit is an SDK that simplifies work with Virgil services and presents the easiest way to add full end-to-end (E2EE) security to their applications to become HIPAA and GDPR compliant and more.

Home Page: https://virgilsecurity.com/

License: BSD 3-Clause "New" or "Revised" License

Swift 46.56% Objective-C 52.62% Ruby 0.83%

e3kit-x's Introduction

Virgil E3Kit Objective-C/Swift SDK

Build Status Carthage compatible CocoaPods Compatible Platform GitHub license

Introduction

Virgil Security provides an SDK which simplifies work with Virgil services and presents easy to use API for adding security to any application. In a few simple steps you can setup user encryption with multidevice support.

SDK Features

  • multidevice support
  • manage users' Public Keys

Installation

Virgil E3Kit is provided as a set of frameworks. These frameworks are distributed via Carthage. Also in this guide, you find one more package called VirgilCrypto (Virgil Crypto Library) that is used by the E3Kit to perform cryptographic operations.

All frameworks are available for:

  • iOS 9.0+
  • macOS 10.10+
  • tvOS 9.0+
  • watchOS 2.0+

COCOAPODS

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Virgil E3Kit into your Xcode project using CocoaPods, specify it in your Podfile:

target '<Your Target Name>' do
use_frameworks!

pod 'VirgilE3Kit', '~> 0.2.0'
end

Then, run the following command:

$ pod install

Carthage

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 VirgilE3Kit 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/e3kit-x" ~> 0.2.0

Linking against prebuilt binaries

To link prebuilt frameworks to your app, run following command:

$ carthage update --no-use-binaries

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:

  • VirgilSDK
  • VirgilCryptoAPI
  • VirgilCryptoApiImpl
  • VirgilCrypto
  • VSCCrypto
  • VirgilPythiaSDK
  • VirgilKeyknoxSDK

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/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
$(SRCROOT)/Carthage/Build/iOS/VirgilPythiaSDK.framework
$(SRCROOT)/Carthage/Build/iOS/VirgilKeyknoxSDK.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:

  • VirgilSDK
  • VirgilCryptoAPI
  • VirgilCryptoApiImpl
  • VirgilCrypto
  • VSCCrypto
  • VirgilPythiaSDK
  • VirgilKeyknoxSDK

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.

Integrating as subproject

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, VirgilSDKKeyknox.xcodeproj, VirgilSDKPythia.xcodeproj and VirgilE3Kit.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:

  • VirgilSDK
  • VirgilCryptoAPI
  • VirgilCryptoApiImpl
  • VirgilCrypto
  • VSCCrypto
  • VirgilSDKPythia
  • VirgilSDKKeyknox
  • VirgilE3Kit

Bootstrap User

Use the following lines of code to authenticate user.

import VirgilE3Kit

// initialize E3Kit
EThree.initialize(tokenCallback) { eThree, error in 
    guard let eThree = eThree, error == nil else {
      // error handling here
    }
    eThree.bootstrap(password: password) { error in 
        // done
    }
}

Encrypt & decrypt

Virgil E3Kit lets you use a user's Private key and his or her Public Keys to sign, then encrypt text.

import VirgilE3Kit

// prepare a message
let messageToEncrypt = "Hello, Bob!"

// initialize E3Kit
EThree.initialize(tokenCallback) { eThree, error in 
    // Authenticate user 
    eThree!.bootstrap(password: password) { error in
        // Search user's publicKeys to encrypt for
        eThree!.lookUpPublicKeys(of: ["Alice", "Den"]) { lookupResult, errors in 
            // encrypt text
            let encryptedMessage = try! eThree.encrypt(messageToEncrypt, for: lookupResult)
        }
    }
}

License

This library is released under the 3-clause BSD License.

Support

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.

e3kit-x's People

Contributors

ogerets avatar sanjodeundiak avatar unlim-it avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.