Skip to content
A wrapper/facade class for PHP's Libsodium extension functions. Covers symmetric and public key encryption functions.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
LICENSE
README.md
composer.json

README.md

Libsodium Facade

A wrapper/facade class for PHP's LibSodium extension. Providing symmetric and public key encryption and decryption static methods, and key generation methods.

Hex-encoded: All output converted to hex. Inputs expecting hex values.

Install

Via Composer:

composer require syntaxseed/libsodium

Or add to composer.json:

"require": {
    "syntaxseed/libsodium": "1.*"
},

Static Functions

  • Symmetric Encryption (one secret key)

    • generateSymmetricKey()
    • symmetricEncrypt($secretString, $symmetricKey)
    • symmetricDecrypt($encryptedString, $nonce, $key)
  • Public-Key Encryption (public/private key pair)

    • generateKeyPair()
    • publicKeyEncrypt($secretString, $theirPublicKey, $ourPrivateKey)
    • publicKeyDecrypt($encryptedString, $nonce, $ourPublicKey, $theirPrivateKey)

Changelog

  • v1.0.0 - Created. Added to GitHub.
    • v1.0.1 - Update readme, add Composer instructions.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.