Skip to content
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.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ci
ethree-common
ethree-kotlin-coroutines
ethree-kotlin
gradle/wrapper
samples
tests
testscoroutines
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE.md
README.md
build.gradle
gradlew
gradlew.bat
settings.gradle

README.md

Virgil E3Kit Android SDK

Build Status GitHub license

Introduction | SDK Features | Install E3Kit SDK | Usage | Samples | License | Support

Introduction

Virgil Security provides the E3Kit SDK which simplifies work with Virgil services and presents an easy-to-use API for adding a security layer to any application. E3Kit interacts with Virgil Cards Service, Keyknox Service and Pythia Service. Virgil E3kit allows you to setup user encryption with multidevice support in just a few simple steps.

SDK Features

  • multi-device support
  • group chats
  • manage users' Public Keys

Install E3Kit SDK

You can install E3Kit SDK using Gradle. Please, choose package that suits best for your needs:

Package Description
E3Kit Standard package for Java/Kotlin with methods responses in callbacks
E3Kit Coroutines Coroutines package with methods responses in Deferred

Samples

You can find the code samples for Java and Kotlin (for Kotlin-Coroutines module as well) here:

Sample type
Android Java
Android Kotlin
Android Kotlin Coroutines
Android Java Firebase
Android Kotlin Firebase

You can run any of them on an emulator to check out the example of how to initialize the SDK, register users and encrypt messages using the E3Kit.

Usage

Register User

Use the following lines of code to authenticate a user.

var eThree: EThree? = null

// Listener for E3Kit initialization
val initializeListener =
    object : EThree.OnResultListener<EThree> {
        override fun onSuccess(result: EThree) {
            // Init done!
            eThree = result
        }

        override fun onError(throwable: Throwable) {
            // Error handling
        }
    }

// initialize E3Kit
EThree.initialize(context, virgilTokenCallback, initializeListener)

Encrypt & decrypt

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

var eThree: EThree? = null
var encryptedData: ByteArray? = null
var encryptedText: String? = null           

// Listener for keys lookup Two
val lookupKeysListenerTwo =
    object : EThree.OnResultListener<Map<String, PublicKey>> {
        override fun onSuccess(result: Map<String, PublicKey>) {
            // Decrypt data using senders public key (In this example it's E3Kit current user)
            val decryptedData = eThree.decrypt(encryptedData!!, result[identityInToken])
            
            // Decrypt data using senders public key (In this example it's E3Kit current user)
            val decryptedText = eThree.decrypt(encryptedText!!, result[identityInToken])
        }

        override fun onError(throwable: Throwable) {
            // Error handling
        }
    }

// Listener for keys lookup
val lookupKeysListener =
    object : EThree.OnResultListener<Map<String, PublicKey>> {
        override fun onSuccess(result: Map<String, PublicKey>) {
            val text = "I was a text, but become a byte array"
            val data = text.toByteArray()

            // Encrypt data using user public keys
            encryptedData = eThree.encrypt(data, result.values.toList())

            // Encrypt message using user public keys
            encryptedText = eThree.encrypt(text, result.values.toList())
            
            // E3Kit using identity that specified in Jwt provided with *virgilTokenCallback*
            eThree!!.lookupPublicKeys(listOf(identityInToken), lookupKeysListenerTwo)
        }

        override fun onError(throwable: Throwable) {
            // Error handling
        }
    }

// Listener for register
val registerListener =
    object : EThree.OnCompleteListener {
        override fun onSuccess() {
            // User private key loaded!
            // Now we need public keys and we ready for end-to-end encrypt.
            eThree!!.lookupPublicKeys(listOf("AliceUUID", "BobUUID"), lookupKeysListener)
        }

        override fun onError(throwable: Throwable) {
            // Error handling
        }
    }

// Listener for E3Kit initialization
val initializeListener =
    object : EThree.OnResultListener<EThree> {
        override fun onSuccess(result: EThree) {
            // Init done!
            eThree = result
            eThree!!.register(registerListener)
        }

        override fun onError(throwable: Throwable) {
            // Error handling
        }
    }

// initialize E3Kit
EThree.initialize(context, virgilTokenCallback, initializeListener)

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 support@VirgilSecurity.com.

Also, get extra help from our support team on Slack.

You can’t perform that action at this time.