2017 © Pedro Peláez
 

library encryption

Encryption package of the CodeCollab project

image

codecollab/encryption

Encryption package of the CodeCollab project

  • Tuesday, September 19, 2017
  • by PeeHaa
  • Repository
  • 1 Watchers
  • 3 Stars
  • 214 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 6 % Grown

The README.md

Encryption

Encryption package of the CodeCollab project, (*1)

Build Status MIT License Latest Stable Version Total Downloads Latest Unstable Version, (*2)

Requirements

PHP7+, (*3)

Installation

Include the library in your project using composer:, (*4)

{
    "require-dev": {
        "codecollab/encryption": "^2"
    }
}

Usage

This library provides common interfaces and exceptions for handling crypto in your applications., (*5)

Generating key

Before being able to encrypt/decrypt data a key needs to be generated / added. To generate a new key use:, (*6)

$key = (new \CodeCollab\Encryption\Defusev2\Key())->generate();

Note: keys should always be stored in a secure location and should never be made public., (*7)

Note: all key share the common CodeCollab\Encryption\Key interface., (*8)

Encrypting

$encryptedData = (new \CodeCollab\Encryption\Defusev2\Encryptor($key))->encrypt('the data to encrypt');

Note: all encryptors share the common CodeCollab\Encryption\Encryptor interface., (*9)

Decrypting

$decryptedData = (new \CodeCollab\Encryption\Defusev2\Decryptor($key))->decrypt($encryptedData);

Note: all decryptors share the common CodeCollab\Encryption\Decryptor interface., (*10)

To decrypt old data encrypted with v1* of this library use the deprecated:, (*11)

$decryptedData = (new \CodeCollab\Encryption\Defuse\Decryptor($key))->decrypt($encryptedData);

Using your current key. For newly encrypted data create a new and separate key., (*12)

Exceptions

This library may emit two different exceptions:, (*13)

  • \CodeCollab\Encryption\CryptoException
  • \CodeCollab\Encryption\FraudException

It is important to properly handle these exceptions in your applications., (*14)

CryptoException

This exception gets thrown when a key could not be generated or when a message could not be en- / decrypted because of system errors., (*15)

FraudException

This exception gets thrown when there has been suspected tampering with messages. This exception should be handled like the message has been tampered with and precautions should be taken., (*16)

Upgrading

When upgrading from from v1* to v2* of this library there are breaking changes., (*17)

It's not possible anymore to generate a new key or encrypt data using the obsolete CodeCollab\Encryption\Defuse\Key and CodeCollab\Encryption\Defuse\Encrypt classes., (*18)

The CodeCollab\Encryption\Defuse package has been superseded by the ``CodeCollab\Encryption\Defusev2` package., (*19)

Decrypting of data is still possible using the deprecated CodeCollab\Encryption\Defuse\Decrypt::decrypt() method and will be for the foreseeable future., (*20)

It is however strongly advised to re-encrypt old data using the new CodeCollab\Encryption\Defusev2 package., (*21)

The workflow for this will be:, (*22)

  • Generate a new key using the new CodeCollab\Encryption\Defusev2\Key::generate() method (But don't overwrite the current key yet!)
  • Decrypt the data using the current key and the CodeCollab\Encryption\Defuse\Decrypt::decrypt() method
  • Encrypt the data using the new CodeCollab\Encryption\Defusev2\Encrypt::encrypt() method with the newly generate key
  • Newly encrypted data can now be decrypted using the new CodeCollab\Encryption\Defusev2\Decrypt::decrypt() method

Contributing

How to contribute, (*23)

License

MIT, (*24)

Security issues

If you found a security issue please contact directly by mail instead of using the issue tracker at codecollab-security@pieterhordijk.com, (*25)

The Versions

19/09 2017

dev-master

9999999-dev https://github.com/CodeCollab/Encryption

Encryption package of the CodeCollab project

  Sources   Download

See the LICENSE file

The Requires

 

The Development Requires

security encryption rijndael codecollab

13/07 2016

2.0.0

2.0.0.0 https://github.com/CodeCollab/Encryption

Encryption package of the CodeCollab project

  Sources   Download

See the LICENSE file

The Requires

 

The Development Requires

security encryption rijndael codecollab

09/12 2015

1.0.2

1.0.2.0 https://github.com/CodeCollab/Encryption

Encryption package of the CodeCollab project

  Sources   Download

See the LICENSE file

The Requires

 

The Development Requires

security encryption rijndael codecollab

07/12 2015

1.0.1

1.0.1.0 https://github.com/CodeCollab/Encryption

Encryption package of the CodeCollab project

  Sources   Download

See the LICENSE file

The Requires

 

The Development Requires

security encryption rijndael codecollab