Skip to content

Latest commit

 

History

History
120 lines (79 loc) · 6.4 KB

README.md

File metadata and controls

120 lines (79 loc) · 6.4 KB

Virgil Security PHP Crypto Library Wrapper

Build Status GitHub license

Introduction | Features | Installation | Docs | License | Contacts

Introduction

This library is designed to be a small, flexible and convenient wrapper for a variety of crypto algorithms. So it can be used in a small microcontroller as well as in a high load server application. Also, it provides a bunch of custom hybrid algorithms that combine different crypto algorithms to solve common complex cryptographic problems in an easy way. That eliminates requirement for developers to have strong cryptographic skills.

Virgil Security PHP Crypto Library Wrapper is a wrapper for Virgil Security Crypto Library.

Features

Virgil Security Crypto library wrapper is decomposed to small libraries with specific purposes, so a developer can freely choose a subset of them.

Library: Foundation

This library contains basic cryptographic algorithms and can be used as building blocks for complex solutions.

Algorithm Purpose Implementation details
Key Generation, PRNG CTR_DRBG NIST SP 800-90A
Key Derivation KDF1, KDF2, HKDF, PBKDF2
Key Exchange X25519, RSA
Hashing SHA-2 (224/256/384/512)
Message Authentication Code HMAC
Digital Signature Ed25519, RSASSA-PSS
Entropy Source Linux, macOS /dev/urandom,
Windows CryptGenRandom()
Symmetric Algorithms AES-256-GCM, AES-256-CBC
Encryption schemes PBES2
Elliptic Curves Ed25519, Curve25519

Library: PHE

Cryptographic background for the Password-Hardened Encryption (PHE) protocol that provides developers with a technology to protect users passwords from offline attacks and make stolen passwords useless even if your database has been compromised.

Library: Pythia

Implementation of the Pythia protocol.

Installation

This package is available for PHP versions: 8.2, 8.3.

  • Step #1. Install the crypto wrapper with the following code:

    composer require virgil/crypto-wrapper
  • Step #2. Add the crypto extensions into your server with the following code and follow the instructions below:

    sh vendor/virgil/crypto-wrapper/_extensions/setup.sh -all -vendor

Additional information

Manual adding the crypto extension to your server

  • Execute on your server virgil-test.php file.

  • Copy extensions files according to your server operating system and PHP version to the extensions directory.

    • For Linux/Darwin:
     $ path="{PASTE_PATH_TO_EXTENSIONS_DIR_HERE}"
     $ cp {PASTE_EXTENSION_NAME_HERE} $path
    
    • For Windows:
     $ set path={PASTE_PATH_TO_EXTENSIONS_DIR_HERE}
     $ copy {PASTE_EXTENSION_NAME_HERE} %path%
    
  • Copy virgil_crypto.ini file according to your server operating system and PHP version to the PATH_TO_ADDITIONAL_INI_FILES:

    • For Linux/Darwin
    $ cp virgil_crypto.ini {PASTE_PATH_TO_ADDITIONAL_INI_FILE_HERE}
    
    • For Windows:
    $ copy virgil_crypto.ini {PASTE_PATH_TO_ADDITIONAL_INI_FILE_HERE}
    
  • Restart your server or php-fpm service

Extensions installation example

Our web stack is: Linux, nginx, php7.2-fpm

  • Execute virgil-test.php to find your path to the extensions directory and the path to the additional ini files (or to the main php.ini file):

  • Then, go to the command line interface (CLI) to specify the paths you've identified in the previous step and restart your server or php-fpm service:

  • Reload the page in your browser to see that the extension is loaded:

Docs

License

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

Support

Our developer support team is here to help you.

You can find us on Twitter or send us email support@VirgilSecurity.com.

Also, get extra help from our support team on Slack.