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
- Generation/Verification of digital signatures
Generate a key pair
Generate a Private Key with the default algorithm (EC_X25519):
;const virgilCrypto = ;const keyPair = virgilCrypto;
Generate and verify a signature
Generate signature and sign data with a private key:
;const virgilCrypto = ;const signingKeypair = virgilCrypto;// prepare a messageconst messageToSign = 'Hello, Bob!';// generate a signatureconst signature = virgilCrypto;// signature is a NodeJS Buffer (or polyfill if in the browser)console;
Verify a signature with a public key:
// verify a signatureconst verified = virgilCrypto;
Encrypt and decrypt data
Encrypt Data on a Public Key:
;const virgilCrypto = ;const encryptionKeypair = virgilCrypto;// prepare a messageconst messageToEncrypt = 'Hello, Bob!';// encrypt the messageconst encryptedData = virgilCrypto;// encryptedData is a NodeJS Buffer (or polyfill if in the browser)console;
Decrypt the encrypted data with a Private Key:
// decrypt the encrypted data using a private keyconst decryptedData = virgilCrypto;// convert Buffer to stringconst decryptedMessage = decryptedData;
Need more examples? Visit our developer documentation.
The recommended way is to install from npm:
npm install virgil-crypto
Important! You will need Node.js version >= 4.5.0 < 5 or >= 6 to use virgil-crypto. If you have a different version, consider upgrading, or use nvm (or a similar tool) to install Node.js of supported version alongside your current installation.
If you only intend to use virgil-crypto in a browser environment, you can ignore this warning.
Support for Pythia algorithms is considered experimental.
Important! Pythia algorithms implementation is not available in Node.js on Windows. An error will be thrown if you try to invoke the
VirgilCryptoPythiaconstructor in Node.js on Windows.
const VirgilPythiaCrypto = ;const virgilPythiaCrypto = ;const tweak = Buffer;const blindingSecret blindedPassword = virgilPythia;const transformationKeyPair = virgilPythia;const transformedPassword transformedTweak = virgilPythia;const proofValueC proofValueU = virgilPythia;const verified = virgilPythia;console;const deblinded = virgilPythia;console;
For browser example, see examples/virgil-pythia.html.
This library is released under the 3-clause BSD License.
Our developer support team is here to help you.
Also, get extra help from our support team on Slack.