This guide is a short tutorial on how to decryptDecryption is the reverse to Encryption and allows one to review plaintext via a Virgil Key related to the Public Key responsible for the initial encryption more ... encrypted data with Virgil Security.
Decryption is the reverse operation of encryption. As previously noted, Virgil Security allows you to encrypt data using public-key encryption. It's means that only the owner of the related private Virgil KeyThe Virgil Key is a wrapper of the user's secure Private Key more ... can decrypt the encrypted data.
Set up your project environment before you start to decrypt data, with the getting started guide.
The Data Decryption procedure is shown in the figure below.
In order to decrypt a message, Bob has to have:
Let's review the data decryption process:
- Developers need to initialize the Virgil SDKThe SDK helps take tedious complexity out of coding by providing APIs for all of Virgil Services.:
virgil = VirgilApi.new(access_token: "[YOUR_ACCESS_TOKEN_HERE]")
- Then Bob:
- Loads the Virgil Key from the secure storage provided by default
- Decrypts the message using his own Virgil Key
# load a Virgil Key from device storage
bob_key = virgil.keys.load("[KEY_NAME]", "[OPTIONAL_KEY_PASSWORD]")
# decrypt a ciphertext using loaded Virgil Key
original_message = bob_key.decrypt(ciphertext).to_s
To load a Virgil Key from a specific storage, developers need to change the storage path during Virgil SDK initialization.
To decrypt the encrypted data, you will need to load Bob's Virgil KeyThe Virgil Key is a wrapper of the user's secure Private Key more .... The Loading Key guide provides more details.