Skip to content

Virgil Ruby Crypto Library is a high-level cryptographic library that allows you to perform all necessary operations for secure storing and transferring data and everything required to become HIPAA and GDPR compliant.

Notifications You must be signed in to change notification settings

VirgilSecurity/virgil-crypto-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Virgil Security Ruby Crypto Library

Build Status Gem GitHub license Documentation YARD

Introduction

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.

Library purposes

  • Asymmetric Key Generation
  • Encryption/Decryption of data and streams
  • Generation/Verification of digital signatures
  • PFS (Perfect Forward Secrecy)

Usage examples

Generate a key pair

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 and verify a signature

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 and decrypt data

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.

Installation

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

Docs

License

This library is released under the 3-clause BSD License.

Support

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.

About

Virgil Ruby Crypto Library is a high-level cryptographic library that allows you to perform all necessary operations for secure storing and transferring data and everything required to become HIPAA and GDPR compliant.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •