All Projects → VirgilSecurity → virgil-sdk-net

VirgilSecurity / virgil-sdk-net

Licence: other
Virgil Core SDK allows developers to get up and running with Virgil Cards Service API quickly and add end-to-end security to their new or existing digital solutions to become HIPAA and GDPR compliant and more.

Programming Languages

C#
18002 projects
shell
77523 projects

Projects that are alternatives of or similar to virgil-sdk-net

virgil-sdk-cpp
Virgil Core SDK allows developers to get up and running with Virgil Cards Service API quickly and add end-to-end security to their new or existing digital solutions to become HIPAA and GDPR compliant and more.
Stars: ✭ 18 (+12.5%)
Mutual labels:  encryption, pki, gdpr, end-to-end-encryption
Virgil Crypto Php
Virgil PHP Crypto Library is a high-level cryptographic library that allows you to perform all necessary operations for secure storing and transferring data and everything required to become HIPAA and GDPR compliant.
Stars: ✭ 22 (+37.5%)
Mutual labels:  encryption, gdpr, end-to-end-encryption
virgil-sdk-x
Virgil Core SDK allows developers to get up and running with Virgil Cards Service API quickly and add end-to-end security to their new or existing digital solutions to become HIPAA and GDPR compliant and more.
Stars: ✭ 27 (+68.75%)
Mutual labels:  pki, gdpr, end-to-end-encryption
Etebase Rs
A Rust client library for Etebase
Stars: ✭ 78 (+387.5%)
Mutual labels:  encryption, end-to-end-encryption
Itext7
iText 7 for Java represents the next level of SDKs for developers that want to take advantage of the benefits PDF can bring. Equipped with a better document engine, high and low-level programming capabilities and the ability to create, edit and enhance PDF documents, iText 7 can be a boon to nearly every workflow.
Stars: ✭ 913 (+5606.25%)
Mutual labels:  encryption, gdpr
Pki.js
PKI.js is a pure JavaScript library implementing the formats that are used in PKI applications (signing, encryption, certificate requests, OCSP and TSP requests/responses). It is built on WebCrypto (Web Cryptography API) and requires no plug-ins.
Stars: ✭ 960 (+5900%)
Mutual labels:  encryption, pki
Darkwire.io
End-to-end encrypted instant web chat
Stars: ✭ 594 (+3612.5%)
Mutual labels:  encryption, end-to-end-encryption
Demo Twilio Backend Nodejs
A sample backend that demonstrates how to generate a Virgil JWT and Twilio token used for authentication with the Virgil and Twilio services
Stars: ✭ 128 (+700%)
Mutual labels:  encryption, end-to-end-encryption
Etebase Js
Etebase TypeScript API for the web, node and react-native!
Stars: ✭ 100 (+525%)
Mutual labels:  encryption, end-to-end-encryption
End to end encryption
🔐 Server API to support End-to-End Encryption
Stars: ✭ 155 (+868.75%)
Mutual labels:  encryption, end-to-end-encryption
Peertransfer
📦 • Send a file p2p and e2e encrypted in your browser using WebRTC.
Stars: ✭ 238 (+1387.5%)
Mutual labels:  encryption, end-to-end-encryption
Server
The Etebase server (so you can run your own)
Stars: ✭ 826 (+5062.5%)
Mutual labels:  encryption, end-to-end-encryption
Laravel Gdpr
GDPR compliance with ease.
Stars: ✭ 189 (+1081.25%)
Mutual labels:  encryption, gdpr
virgil-crypto-javascript
Virgil JavaScript Crypto Library is a high-level cryptographic library that allows you to perform all necessary operations for secure storing and transferring data and everything required to become HIPAA and GDPR compliant.
Stars: ✭ 31 (+93.75%)
Mutual labels:  gdpr, end-to-end-encryption
Brandis
Brandis: End-to-end encryption for everyone
Stars: ✭ 77 (+381.25%)
Mutual labels:  encryption, end-to-end-encryption
Itext7 Dotnet
iText 7 for .NET is the .NET version of the iText 7 library, formerly known as iTextSharp, which it replaces. iText 7 represents the next level of SDKs for developers that want to take advantage of the benefits PDF can bring. Equipped with a better document engine, high and low-level programming capabilities and the ability to create, edit and enhance PDF documents, iText 7 can be a boon to nearly every workflow.
Stars: ✭ 698 (+4262.5%)
Mutual labels:  encryption, gdpr
Databunker
Secure storage for personal records built to comply with GDPR
Stars: ✭ 122 (+662.5%)
Mutual labels:  encryption, gdpr
etesync-notes
An EteSync backed note taking app
Stars: ✭ 64 (+300%)
Mutual labels:  encryption, end-to-end-encryption
Wormhole William
End-to-end encrypted file transfer. A magic wormhole CLI and API in Go (golang).
Stars: ✭ 256 (+1500%)
Mutual labels:  encryption, end-to-end-encryption
Android
EteSync - Secure, end-to-end encrypted, and privacy respecting sync for your contacts, calendars and tasks.
Stars: ✭ 184 (+1050%)
Mutual labels:  encryption, end-to-end-encryption

Virgil Core SDK .NET/C#

Build status Nuget package GitHub license

Introduction | SDK Features | Installation | Configure SDK | Usage Examples | Docs | Support

Introduction

Virgil Security provides a set of APIs for adding security to any application. In a few simple steps you can encrypt communications, securely store data, and ensure data integrity. Virgil Security products are available for desktop, embedded (IoT), mobile, cloud, and web applications in a variety of modern programming languages.

The Virgil Core SDK is a low-level library that allows developers to get up and running with Virgil Cards Service API quickly and add end-to-end security to their new or existing digital solutions.

In case you need additional security functionality for multi-device support, group chats and more, try our high-level Virgil E3Kit framework.

SDK Features

Installation

The Virgil Core SDK .NET is provided as a package named Virgil.SDK. The package is distributed via NuGet package management system.

Supported Platforms:

  • .NET Standard 1.1+
  • .NET Framework 4.5+
  • .NET Core 1.0+
  • Universal Windows Platform 10
  • Windows 8.0+
  • Windows Phone 8.1+
  • Xamarin.Android 7.0+
  • Xamarin.iOS 10.0+
  • Xamarin.Mac 3.0+
  • Mono 4.6+ (OSX)

Installing the package using Package Manager Console:

Run PM> Install-Package Virgil.SDK

Configure SDK

This section contains guides on how to set up Virgil Core SDK modules for authenticating users, managing Virgil Cards and storing private keys.

Set up authentication

Set up user authentication with tokens that are based on the JSON Web Token standard with some Virgil modifications.

In order to make calls to Virgil Services (for example, to publish user's Card on Virgil Cards Service), you need to have a JSON Web Token ("JWT") that contains the user's identity, which is a string that uniquely identifies each user in your application.

Credentials that you'll need:

Parameter Description
App ID ID of your Application at Virgil Dashboard
App Key ID A unique string value that identifies your account at the Virgil developer portal
App Key A Private Key that is used to sign API calls to Virgil Services. For security, you will only be shown the App Key when the key is created. Don't forget to save it in a secure location for the next step

Set up JWT provider on Client side

Use these lines of code to specify which JWT generation source you prefer to use in your project:

using Virgil.SDK;

// Get generated token from server-side
Func<TokenContext, Task<string>> obtainTokenCallback = async (ctx) =>
{
     var jwtFromServer = await AuthenticatedQueryToServerSide(tokenContext);
     return jwtFromServer;
};

// Setup AccessTokenProvider
var accessTokenProvider = new CallbackJwtProvider(obtainTokenCallback);

Generate JWT on Server side

Next, you'll need to set up the JwtGenerator and generate a JWT using the Virgil SDK.

Here is an example of how to generate a JWT:

using Virgil.Crypto;
using Virgil.SDK;

// App Key (you got this Key at Virgil Dashboard)
var appKeyBase64 = "MIGhMF0GCSqGSIb3DQEFDTBQMC8GCSqGSIb3DQEFDDAiBBC7Sg/DbNzhJ/uakTvafUMoAgIUtzAKBggqhkiG9w0CCjAdBglghkgBZQMEASoEEDunQ1yhWZoKaLaDFgjpxRwEQAFdbC8e6103lJrUhY9ahyUA8+4rTJKZCmdTlCDPvoWH/5N5kxbOvTtbxtxevI421z3gRbjAtoWkfWraSLD6gj0=";
var privateKeyData = Bytes.FromString(appKeyBase64, StringEncoding.BASE64);

// Crypto library imports a private key into a necessary format
var crypto = new VirgilCrypto();
var appKey = crypto.ImportPrivateKey(privateKeyData, appKeyPassword);

//  initialize accessTokenSigner that signs users JWTs
var accessTokenSigner = new VirgilAccessTokenSigner();

// use your App Credentials you got at Virgil Dashboard:
var appId = "be00e10e4e1f4bf58f9b4dc85d79c77a"; // App ID
var appKeyId = "70b447e321f3a0fd"; // App Key ID
var ttl = TimeSpan.FromHours(1); // 1 hour (JWT's lifetime)

// setup JWT generator with necessary parameters:
var jwtGenerator = new JwtGenerator(appId, appKey, appKeyId, ttl, accessTokenSigner);

// generate JWT for a user
// remember that you must provide each user with his unique JWT
// each JWT contains unique user's identity (in this case - Alice)
// identity can be any value: name, email, some id etc.
var identity = "Alice";
var aliceJwt = jwtGenerator.GenerateToken(identity);

// as result you get users JWT, it looks like this: "eyJraWQiOiI3MGI0NDdlMzIxZjNhMGZkIiwidHlwIjoiSldUIiwiYWxnIjoiVkVEUzUxMiIsImN0eSI6InZpcmdpbC1qd3Q7dj0xIn0.eyJleHAiOjE1MTg2OTg5MTcsImlzcyI6InZpcmdpbC1iZTAwZTEwZTRlMWY0YmY1OGY5YjRkYzg1ZDc5Yzc3YSIsInN1YiI6ImlkZW50aXR5LUFsaWNlIiwiaWF0IjoxNTE4NjEyNTE3fQ.MFEwDQYJYIZIAWUDBAIDBQAEQP4Yo3yjmt8WWJ5mqs3Yrqc_VzG6nBtrW2KIjP-kxiIJL_7Wv0pqty7PDbDoGhkX8CJa6UOdyn3rBWRvMK7p7Ak"
// you can provide users with JWT at registration or authorization steps
// Send a JWT to client-side
var jwtString = aliceJwt.ToString();

For this subsection we've created a sample backend that demonstrates how you can set up your backend to generate the JWTs. To set up and run the sample backend locally, head over to your GitHub repo of choice:

Node.js | Golang | PHP | Java | Python and follow the instructions in README.

Set up Card Verifier

Virgil Card Verifier helps you automatically verify signatures of a user's Card, for example when you get a Card from Virgil Cards Service.

By default, VirgilCardVerifier verifies only two signatures - those of a Card owner and Virgil Cards Service.

Set up VirgilCardVerifier with the following lines of code:

using Virgil.Crypto;
using Virgil.SDK;

// initialize Crypto library
var cardCrypto = new VirgilCardCrypto();

var yourBackendVerifierCredentials = new VerifierCredentials()
{
	Signer = "YOUR_BACKEND",
	PublicKeyBase64 = publicKeyStr
};

 var yourBackendWhitelist = new Whitelist()
{
    VerifiersCredentials = new List<VerifierCredentials>()
    {
        yourBackendVerifierCredentials
    }
};

var verifier = new VirgilCardVerifier(cardCrypto)
            {
                Whitelists = new List<Whitelist>() { yourBackendWhitelist }
            };

Set up Card Manager

This subsection shows how to set up a Card Manager module to help you manage users' public keys.

With Card Manager you can:

  • specify an access Token (JWT) Provider.
  • specify a Card Verifier used to verify signatures of your users, your App Server, Virgil Services (optional).

Use the following lines of code to set up the Card Manager:

// initialize cardManager and specify accessTokenProvider, cardVerifier
var cardManagerParams = new CardManagerParams()
{
    CardCrypto = cardCrypto,
    AccessTokenProvider = accessTokenProvider,
    Verifier = verifier
};

   var cardManager = new CardManager(cardManagerParams);

Usage Examples

Before you start practicing with the usage examples, make sure that the SDK is configured. See the Configure SDK section for more information.

Generate and publish Virgil Cards at Cards Service

Use the following lines of code to create a user's Card with a public key inside and publish it at Virgil Cards Service:

using Virgil.Crypto;
using Virgil.SDK;

var crypto = new VirgilCrypto();

// generate a key pair
var keyPair = crypto.GenerateKeys();

// save Alice private key into key storage
privateKeyStorage.Store(keyPair.PrivateKey, "Alice");

// create and publish user's card with identity Alice on the Cards Service
var card = await cardManager.PublishCardAsync(
    new CardParams()
    {
        PublicKey = keyPair.PublicKey,
        PrivateKey = keyPair.PrivateKey,
    });

Sign then encrypt data

Virgil Core SDK allows you to use a user's private key and their Virgil Cards to sign and encrypt any kind of data.

In the following example, we load a private key from a customized key storage and get recipient's Card from the Virgil Cards Service. Recipient's Card contains a public key which we will use to encrypt the data and verify a signature.

using Virgil.Crypto;
using Virgil.SDK;

// prepare a message
var messageToEncrypt = "Hello, Bob!";
var dataToEncrypt = Encoding.UTF8.GetBytes(messageToEncrypt);

// load a private key from a device storage
var (alicePrivateKey, alicePrivateKeyAdditionalData) = privateKeyStorage.Load("Alice");

// using cardManager search for Bob's cards on Cards Service
var cards = await cardManager.SearchCardsAsync("Bob");
var bobRelevantCardsPublicKeys = cards.Select(x => x.PublicKey).ToArray();

// sign a message with a private key then encrypt using Bob's public keys
var encryptedData = crypto.SignThenEncrypt(dataToEncrypt, alicePrivateKey, bobRelevantCardsPublicKeys);

Decrypt data and verify signature

Once the user receives the signed and encrypted message, they can decrypt it with their own private key and verify the signature with the sender's Card:

using Virgil.Crypto;
using Virgil.SDK;

// load a private key from a device storage
var (bobPrivateKey, bobPrivateKeyAdditionalData) = privateKeyStorage.Load("Bob");

// using cardManager search for Alice's cards on Cards Service
var cards = await cardManager.SearchCardsAsync("Alice");
var aliceRelevantCardsPublicKeys = cards.Select(x => x.PublicKey).ToArray();

// decrypt with a private key and verify using one of Alice's public keys
var decryptedData = crypto.DecryptThenVerify(encryptedData, bobPrivateKey, aliceRelevantCardsPublicKeys);

Get Card by its ID

Use the following lines of code to get a user's card from Virgil Cloud by its ID:

using Virgil.SDK;

// using cardManager get a user's card from the Cards Service
var card = await cardManager.GetCardAsync("f4bf9f7fcbedaba0392f108c59d8f4a38b3838efb64877380171b54475c2ade8");

Get Card by user's identity

For a single user, use the following lines of code to get a user's Card by a user's identity:

using Virgil.SDK;

// using cardManager search for user's cards on Cards Service
var cards = await cardManager.SearchCardsAsync("Bob");

Docs

Virgil Security has a powerful set of APIs, and the Developer Documentation can get you started today.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].