Decrypt the Encrypted Data
The Decrypt Command,
virgil decrypt, decrypts the encrypted data with a
This command has the following syntax:
virgil decrypt [options...] [-i <file>] [-o <file>] [-c <file>] [-p <arg>] <keypass>
The keypass consists of the given password used as the
recipient-id or the user's
Virgil Key associated with the
Public Key used for encryption. You also may need the
Virgil Key password if there is one.
Please note that you will need a password and/or the recipient-id for encryption.
The main options are:
-i <file>, --in=<file> - The file with data that must be decrypted. If omitted, stdin is used.
-o <file>, --out=<file> - The file with the decrypted data. If omitted, stdout is used.
-c <file>, --content-info=<file> -Content info. Use this option if the content info was not embedded in the encrypted data.
-p <arg>, --private-key-password=<arg> -User's Virgil Key Password.
<keypass> - Contains a User’s Virgil Key or password. The format of which is the following:
- If privkey then:
<value> - Recipient’s Virgil Key,
<alias> - User’s Virgil Key alias;
- If password then:
<value> - Recipient’s password,
<alias> - Ignored.
Prerequisites for work with the command
In order to correctly use the Decrypt Command,
virgil decrypt, we must keep the following in mind:
- If you have encrypted a file with only a password, you only need to install the CLI;
- If the file was encrypted using a User's identity (public key, Virgil Card ID etc.), one must generate a Private Key and appropriate it to a Virgil Card.
Example #1. Anyone with the appropriate password decrypts some encrypted file called enc.txt:
virgil decrypt -i enc.txt -o plain.txt password:strong_password
This results in the creation of a decrypted file (plain.txt). In this example, the decrypted file will be stored to the folder, from which the command was run. In order to see the file's content, use output commands (for example: cat plain.txt):
Hey, how's it going?
Example #2. Bob decrypts 'enc.txt' with his Private Key, accompanied with the alias 'ForBob':
virgil decrypt -i enc.txt -o plain.txt privkey:private.virgilkey:ForBob -p BobsKeyPswd
This results in the creation of a decrypted file (plain.txt), which will be stored to the folder, from which the command was run. In order to see the file's content, use output commands (for example: cat plain.txt):
Hey Bob, how's it going?