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.
aliceCards, err := api.Cards.Find("alice")
message := virgilapi.BufferFromString("Hello Alice!")
cipherData, err := aliceCards.Encrypt(message)
transmit(cipherData.ToBase64String())
Alice uses her Virgil Private Key to decrypt the encrypted message.
aliceKey, err := api.Keys.Load("alice_key_1", "mypassword")
encryptedData, err := virgilapi.BufferFromBase64String(transferData)
originalData, err := 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.