2017 © Pedro Peláez
 

library sodium-encryption

Encrypt and decrypt data with this easy to use PHP encryption library

image

internetpixels/sodium-encryption

Encrypt and decrypt data with this easy to use PHP encryption library

  • Thursday, July 12, 2018
  • by Petervw
  • Repository
  • 1 Watchers
  • 2 Stars
  • 59 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Sodium PHP encryption library

Protect your data and secure every field in your entities with this tiny encryption library!, (*1)

This is a open-source library. Please consider a link to this repository when you're actively using it., (*2)

License Build Status Maintainability, (*3)

Install with composer

This small encryption/decryption library can be required by using composer. Please use the following command:, (*4)

composer require internetpixels/sodium-encryption

Setup the TokenManager

You have to set the secret and public tokens once. Those keys are not allowed to change overtime!, (*5)

<?php
// Update the keys (create a new unique keypair)!
\InternetPixels\SodiumEncryption\EncryptionManager::setKeys(
    '1d17336ba7b2cec7dc8ec788e78ebf835d9f85cfc414275e92fd8e3ae5d6d2b6',
    'b88fc95850eec82492e9f0616cfeb69b9205735e34f5ce5e83d681eb38147d57'
);

Encrypt a field

We advise you to create a unique nonce per entity (use the EncryptionManager::generateNonce() method). You'll have to save the nonce with your data too, because it will be used when you want to decrypt the data again., (*6)

<?php
$string = 'This is my default text string with 88 numbers!';
$nonce = EncryptionManager::generateNonce();

$encrypted = EncryptionManager::encrypt($string, $nonce);

Decrypt a field

In order to decrypt a field, you'll need the encrypted string and the nonce., (*7)

<?php
$string = EncryptionManager::decrypt($encrypted, $nonce);

The Versions

12/07 2018

dev-master

9999999-dev

Encrypt and decrypt data with this easy to use PHP encryption library

  Sources   Download

The Requires

  • php >=7.1

 

The Development Requires

by Peter van Wilderen

15/06 2018

1.0.0

1.0.0.0

Encrypt and decrypt data with this easy to use PHP encryption library

  Sources   Download

The Requires

  • php >=7.1

 

The Development Requires

by Peter van Wilderen