VirgilCrypto is a stack of security libraries (ECIES with Crypto Agility wrapped in Virgil Cryptogram) and an open-source high-level cryptographic library that allows you to perform all necessary operations for securely storing and transferring data in your digital solutions. Crypto Library is written in C++ and is suitable for mobile and server platforms.
Virgil Security, Inc., guides software developers into the forthcoming security world in which everything will be encrypted (and passwords will be eliminated). In this world, the days of developers having to raise millions of dollars to build a secure chat, secure email, secure file-sharing, or a secure anything have come to an end. Now developers can instead focus on building features that give them a competitive market advantage while end-users can enjoy the privacy and security they increasingly demand.
- Asymmetric Key Generation
- Encryption/Decryption of data and streams
- Generation/Verification of digital signatures
- PFS (Perfect Forward Secrecy)
Generate a Private Key with the default algorithm (EC_X25519):
require 'virgil/crypto'
include Virgil::Crypto
crypto = VirgilCrypto.new
key_pair = crypto.generate_keys
Generate signature and sign data with a private key:
require 'virgil/crypto'
include Virgil::Crypto
crypto = VirgilCrypto.new
# prepare a message
message_to_sign = 'Hello, Bob!'
data_to_sign = Bytes.from_string(message_to_sign)
# generate a signature
signature = crypto.generate_signature(data_to_sign, sender_private_key)
Verify a signature with a public key:
require 'virgil/crypto'
include Virgil::Crypto
crypto = VirgilCrypto.new
# verify a signature
verified = crypto.verify_signature(signature, data_to_sign, sender_public_key)
Encrypt Data on a Public Key:
require 'virgil/crypto'
include Virgil::Crypto
crypto = VirgilCrypto.new
# prepare a message
message_to_encrypt = 'Hello, Bob!'
data_to_encrypt = Bytes.from_string(message_to_encrypt)
# encrypt the message
encrypted_data = crypto.encrypt(data_to_encrypt, receiver_public_key)
Decrypt the encrypted data with a Private Key:
require 'virgil/crypto'
include Virgil::Crypto
crypto = VirgilCrypto.new
# prepare data to be decrypted
decrypted_data = crypto.decrypt(encrypted_data, receiver_private_key)
# decrypt the encrypted data using a private key
decrypted_message = Bytes.new(decrypted_data).to_s
Need more examples? Visit our developer documentation.
TThe Virgil Crypto is provided as a gem named virgil-crypto and available for Ruby 2.1 and newer. The package is distributed via bundler package manager.
To install the package use the command below:
gem install virgil-crypto
or add the following line to your Gemfile:
gem 'virgil-crypto', '~> 3.6.5'
and then run
bundle
This library is released under the 3-clause BSD License.
Our developer support team is here to help you. Find out more information on our Help Center.
You can find us on Twitter or send us email support@VirgilSecurity.com.
Also, get extra help from our support team on Slack.