Installation | Encryption Example | Initialization | Documentation | Support
Virgil Security provides a set of APIs for adding security to any application. In a few simple steps you can encrypt communication, securely store data, provide passwordless login, and ensure data integrity.
For a full overview head over to our Go Get Started guides.
Run go get -u gopkg.in/virgil.v4
then add import
import "gopkg.in/virgil.v4"
Next: Get Started with the Go SDK.
Virgil Security makes it super easy to add encryption to any application. With our SDK you create a public Virgil Card for every one of your users and devices. With these in place you can easily encrypt any data in the client.
// find Alice's card(s)
aliceCards, err := api.Cards.Find("alice")
// encrypt the message using Alice's cards
message := virgilapi.BufferFromString("Hello Alice!")
cipherData, err := aliceCards.Encrypt(message)
//transmit the message using your preferred technology
transmit(cipherData.ToBase64String())
The receiving user then uses their stored private key to decrypt the message.
// load alice's 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 Private key.
originalData, err := aliceKey.Decrypt(encryptedData)
// originalData = aliceKey.Decrypt(encryptedData)
originalMessage := originalData.ToString()
Next: To get you properly started you'll need to know how to create and store Virgil Cards. Our Get Started guide will get you there all the way.
Also: Encrypted communication is just one of the few things our SDK can do. Have a look at our guides on Encrypted Storage, Data Integrity and Passwordless Login for more information.
To use this SDK you need to sign up for an account and create your first application. Make sure to save the app id, private key and it's password. After this, create an application token for your application to make authenticated requests from your clients.
To initialize the SDK on the client side you will only need the access token you created.
// initialize Virgil SDK
api, err := virgilapi.New("[YOUR_ACCESS_TOKEN_HERE]")
Note: this client will have limited capabilities. For example, it will be able to generate new Cards but it will need a server-side client to transmit these to Virgil.
To initialize the SDK on the server side we will need the access token, app id and the App Key you created on the Developer Dashboard.
key, err :=ioutil.ReadFile("mykey.key")
...
api, err := virgilapi.NewWithConfig(virgilapi.Config{
Token: "AT.[YOUR_ACCESS_TOKEN_HERE]",
Credentials: &virgilapi.AppCredentials{
AppId: "[APP_CARD_ID]",
PrivateKey: key,
PrivateKeyPassword: "YOUR_PASSWORD"
},
CardVerifiers: map[string]virgilapi.Buffer{
cardServiceID: virgilapi.BufferFromString(cardsServicePublicKey),
},
SkipBuiltInVerifiers: true,
})
Next: Learn more about our the different ways of initializing the .NET/C# SDK in our documentation.
Virgil Security has a powerful set of APIs, and the documentation is there to get you started today.
- Get Started documentation
- Guides
This library is released under the 3-clause BSD License.
Our developer support team is here to help you. You can find us on Twitter and email.