Decrypt a message & Verify its signature
Once the Recipient receives the signed and encrypted message, he can decrypt and validate the message. Thus proving that the message has not been tampered with, by verifying the signature against the Sender's Virgil CardEach Card contains attributes associated with the holder of the Private key and are used to prove the ownership of a Public key more ....
In order 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 ... the encrypted message and then verify the signature, we need to load a private receiver's Virgil KeyThe Virgil Key is a wrapper of the user's secure Private Key more ... and search for the sender's Virgil Card at Virgil Services.
# load a Virgil Key from device storage
bob_key = virgil.keys.load("[KEY_NAME]", "[OPTIONAL_KEY_PASSWORD]")
# get a sender's Virgil Card
alice_card = virgil.cards.get("[ALICE_CARD_ID]")
cipher_buff = VirgilBuffer.from_string(cipher_text)
# decrypt the message
original_message = bob_key.decrypt_then_verify(cipher_buff, alice_card).to_string()
In many cases you will need the Sender's Virgil Cards. See Finding Cards guide to find them.
That's it. You've now learned how to use Virgil Security for verifiably encrypted communication. You've learned how to:
- Create a Virgil Key
- Publish a Virgil Card
- Encrypt data using a Virgil Card for a recipient
- Create a signature for data using a Virgil Key
- Decrypt and verify data using a Virgil Key and a Virgil Card