Skip to content
Vlad Evka edited this page May 25, 2016 · 48 revisions

Virgil Security CLI

Quickstart

Motivation

The virgil program is a command line tool for using Virgil Security stack functionality:

  • encrypt, decrypt, sign and verify data;
  • interact with Virgil Keys Service;
  • interact with Virgil Private Keys Service.

Using virgil cli with committing to services

Let's create two users Alice and Bob and demonstrate the communication between them.

mkdir alice
mkdir bob

Scenario for Alice is shown below, particularly Generate Keys and Create a Global Virgil Card. The same actions are performed for Bob.

Generate Keys

  1. Generate default Private Key(Elliptic 384-bits NIST Curve). You will be asked to enter the Private key password:

    virgil keygen -o alice/private.key
    
  2. Extracted a Public Key from the Private Key

    virgil key2pub -i alice/private.key -o alice/public.key
    

Create a Global Virgil Card

virgil card-create-global -d alice@domain.com --public-key alice/public.key -k alice/private.key -o alice/alice.vcard

Encrypt and decrypt data

  1. Encrypt. Bob encrypts plain.txt for Alice. Bob needs Alice Global Card to encrypt some data for Alice. He can get it from the Public Keys Service by indicating Alice email. Encrypt data for Alice identified by email:

     virgil encrypt -i plain.txt -o plain.txt.enc email:alice@domain.com
    
  2. Decrypt. Alice decrypts plain.txt.enc with her Private key and her Card. Alice decrypts the data on her side:

     virgil decrypt -i plain.txt.enc -k alice/private.key -r vcard:alice/alice.vcard
    

Sign and verify data

  1. Sign. Private Key is required in order to make a signature. Alice signs data:

     virgil sign -i plain.txt -o plain.txt.sign -k alice/private.key
    
  2. Verify. Bob verifies Alice's signature. He must have Alice's Global Virgil Card to verify the signature.

     mkdir alice-domain        
     virgil card-search-global -e alice@domain.com -o alice-domain/
     virgil verify -i plain.txt -s plain.txt.sign -r vcard:alice-domain/alice.vcard
    

Using virgil-cli without committing to services

Encrypt and decrypt data

  1. Encrypt. Alice encrypts plain.txt for Bob. Alice must have Bob's Public key + recipient's identifier in order to encrypt the data for Bob. pubkey is an argument, which contains Public Key and recipient's identifier. recipient's identifier is a plain text, which is needed for the Public key association. Encrypt data for Bob:

     virgil encrypt -i plain.txt -o plain.txt.enc pubkey:bob/public.key:ForBob
    
  2. Decrypt. Bob decrypts plain.txt.enc using his Private Key and recipient's identifier, which has been provided by Alice. Bob decrypts the data on his side:

     virgil decrypt -i plain.txt.enc -k bob/private.key -r id:ForBob
    

Sign and verify data

  1. Sign. Alice signs the data:

     virgil sign -i plain.txt -o plain.txt.sign -k alice/private.key
    
  2. Verify. Bob verifies Alice's signature. He must have Alice's Public key to verify the signature.

     virgil verify -i plain.txt -s plain.txt.sign -r pubkey:alice/public.key
    

Build Unix

  • Compiler:
    • g++ (version >= 4.8.5), or
    • clang++ (version >= 3.5)
  • CMake (accessible in command prompt). Minimum version: 3.2.
  • Git (accessible in command prompt).
  • libcurl-devel + SSL
  • For Ubuntu (package libcurl4-openssl-dev):

         apt-get -y install git libcurl4-openssl-dev
    
  • For Mac OS X:

        brew install curl --with-openssl
    

Unix build steps

  1. Open terminal

  2. Clone project

       git clone https://github.com/VirgilSecurity/virgil-cli.git
    
  3. Go to the project's folder.

       cd virgil-cli
    
  4. Checkout specific branch.

       git checkout release
    
  5. Create folder for the build purposes and go to it

       mkdir build && cd build
    
  6. Configure, build and install

       cmake .. && make && make install
    
  7. Check installation

       virgil --version
    

Build Windows MSVC

Windows MSVC toolchain

Windows MSVC build steps

  1. Open Visual Studio Command Prompt

  2. Clone project

       git clone https://github.com/VirgilSecurity/virgil-cli.git
    
  3. Go to the project's folder.

       cd virgil-cli
    
  4. Checkout specific branch.

       git checkout release
    
  5. Create folder for the build purposes and go to it

       mkdir build
       cd build
    
  6. Configure, build and make installer

       cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ..
       nmake
       nmake package
    
  7. Check installer under build directory

       dir /B | findstr /R /C:"virgil-cli-*"
    

License

BSD 3-Clause. See LICENSE for details.

Contacts

Email: support@virgilsecurity.com