This guide is a short tutorial on how to data with Virgil Security. You will encrypt data using a Public Key, which is saved on the user's . Once encrypted, only the owner of the related Private Key will be able to decrypt the encrypted data. Therefore, you need to search for a user's Virgil Cards at and then encrypt the data using the appropiate Virgil Card.
Encryption can be used to provide high levels of security to network communications, e-mails, files stored on the cloud, and other information that requires protection.
For original information about encryption, its syntax and parameters, follow the link here.
Set up your project environment before you begin to encrypt data, with the getting started guide.
The Data Encryption procedure is shown in the figure below.
In order to encrypt a message, Alice has to have:
- Bob's Virgil Cards, which should be published on .
Do not forget that Bob can have a as well as an Application Virgil Card. If Alice is not a user of a specific Application, she will only be able to find Bob's Global Virgil Cards.
Let's review the data encryption process:
- Developers need to initialize the
var virgil = new VirgilApi("[YOUR_ACCESS_TOKEN_HERE]");
- Then Alice:
- Searches for Bob's Virgil Card on Virgil Services
- Prepares the message for Bob
- Encrypts the message for Bob
// search for Virgil Cards
var bobCards = await virgil.Cards.FindAsync("bob");
var message = "Hey Bob, how's it going?";
// encrypt the message using found Virgil Cards
var ciphertext = bobCards.Encrypt(message).ToString(StringEncoding.Base64);
Alice can now send the encrypted message to Bob.