You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

gopkg.in/virgilsecurity/virgil-sdk-go.v4

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gopkg.in/virgilsecurity/virgil-sdk-go.v4

Package virgil is the pure Go implementation of Virgil Security compatible SDK Right now it supports only ed25519 keys and signatures and curve25519 key exchange As for symmetric crypto, it's AES256-GCM Hashes used are SHA-384 for signature and SHA-256 for fingerprints


Version published

Readme

Source

Virgil Security Go SDK

Installation | Initialization | Encryption / Decryption Example | Documentation | Support

Virgil Security provides a set of APIs for adding security to any application. In a few steps you can encrypt communication, securely store data, provide passwordless authentication, and ensure data integrity.

To initialize and use Virgil SDK, you need to have Developer Account.

Installation

The package is available for Go 1.7.1 and newer.

Installing the package using Package Manager Console

go get -u gopkg.in/virgil.v4

Initialization

Be sure that you have already registered at the Dev Portal and created your application.

To initialize the SDK at the Client Side you need only the Access Token created for a client at Dev Portal. The Access Token helps to authenticate client's requests.

api, err := virgilapi.New("[YOUR_ACCESS_TOKEN_HERE]")

To initialize the SDK at the Server Side you need the application credentials (Access Token, App ID, App Key and App Key Password) you got during Application registration at the Dev Portal.

keyfile, err := ioutil.ReadFile("[YOUR_APP_KEY_FILEPATH_HERE]")

api, err := virgilapi.NewWithConfig(virgilapi.Config{
        Token: "[YOUR_ACCESS_TOKEN_HERE]",
        Credentials: &virgilapi.AppCredentials{
            AppId: "[YOUR_APP_ID_HERE]",
            PrivateKey: keyfile,
            PrivateKeyPassword : "[YOUR_APP_KEY_PASSWORD_HERE]",
        },
    })

Encryption / Decryption Example

Virgil Security simplifies adding encryption to any application. With our SDK you may create unique Virgil Cards for your all users and devices. With users' Virgil Cards, you can easily encrypt any data at Client Side.

// find Alice's Virgil Card(s) at Virgil Services
aliceCards, err := api.Cards.Find("alice")

// encrypt the message using Alice's Virgil Cards
message := virgilapi.BufferFromString("Hello Alice!")
cipherData, err := aliceCards.Encrypt(message)

//transmit the message using your preferred technology to Alice
transmit(cipherData.ToBase64String())

Alice uses her Virgil Private Key to decrypt the encrypted message.

// load Alice's Virgil Key from secure storage provided by default.
aliceKey, err := api.Keys.Load("alice_key_1", "mypassword")

// get buffer from base64 encoded string
encryptedData, err := virgilapi.BufferFromBase64String(transferData)

// decrypt message using Alice's Virgil key.
originalData, err := aliceKey.Decrypt(encryptedData)

// originalData = aliceKey.Decrypt(encryptedData)
originalMessage := originalData.ToString()

Next: On the page below you can find configuration documentation and the list of our guides and use cases where you can see appliance of Virgil Go SDK.

Documentation

Virgil Security has a powerful set of APIs and the documentation to help you get started:

License

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

Support

Our developer support team is here to help you. You can find us on Twitter and email.

FAQs

Package last updated on 15 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc