The Sign Command,
virgil sign, signs data with a provided User’s Virgil Key. This private key should only be in the possession of the signatory, since it serves as a key for both data verification and data decryption.
This command has the following syntax:
virgil sign [options...] [-i <file>] [-o <file>] -k <file> [-p <arg>] [--hash-algorithm <hash-alg>]
The main options are:
-i <file>, --in=<file> -The file with data that must be signed. If omitted, stdin is used.
-o <file>, --out=<file> -The signed data. If omitted, stdout is used.
-k <file>, --private-key=<file> -The file that contains the signer's Virgil Key.
-p <arg>, --private-key-password=<arg> - The Virgil Key password.
--hash-algorithm=<hash-alg> -The underlying hash algorithm [default: sha384].
- All hash algorithms:
- sha1 - Secure Hash Algorithm 1;
- sha224 - Secure Hash Algorithm 2, with a 224 bits digest;
- sha256 - Secure Hash Algorithm 2, with a 256 bits digest;
- sha384 - Secure Hash Algorithm 2, with a 384 bits digest;
- sha512 - Secure Hash Algorithm 2, with a 512 bits digest.
Prerequisites for work with the command
In order to use the Sign Command,
virgil sign, one must first:
Example #1. Alice signs some plain.txt with her Virgil Key, which is protected with the password "STRONGPASS".
virgil sign -i plain.txt -o plain.signed -k private.virgilkey -p passforkey
Executing this command will result in the creation of a signed file. In this case, the signed file will be stored to the folder from which the command was run. In order to see the newly signed file's content, use base64 format commands (for example: base64 plain.signed):
Example #2. Alice signs some 'plain.txt' with her Private Key using the 256 bits secure Hash Algorithm.
virgil sign -i plain.txt -o plain.signed -k private.virgilkey -p passforkey --hash-algorithm sha256
In order to see this signed file's content, use base64 format (for example: base64 plain.signed).