PHP implementation of RNCryptor

Curtis Farnham 6155afba39 Removing setIterations() commented lines from examples. We do not want to encourage people to use this. 4 years ago
examples 6155afba39 Removing setIterations() commented lines from examples. We do not want to encourage people to use this. 4 years ago
src 8374586b80 Custom iterations: Inline docs and warnings; Code cleanups and tweaks; Unit tests 4 years ago
tests 8374586b80 Custom iterations: Inline docs and warnings; Code cleanups and tweaks; Unit tests 4 years ago
vendor c7f5692f90 Adding reference to RNCryptor-Spec as a git submodule 10 years ago
.gitignore ab365ef558 Code modernization and PSR-2 7 years ago
.gitmodules c7f5692f90 Adding reference to RNCryptor-Spec as a git submodule 10 years ago
.travis.yml 9ab58be8eb Updating for PHP 7.2; Fixing tabs in composer.json 6 years ago
CREDITS 0008f8daad Bugfix: Composer.json was not working; Updating code to use PHP namespaces; Reorganizing filesystem for better usability 10 years ago
LICENSE a57ffe6014 Removing cruft from pre-Composer days 7 years ago
README.md eed22a5552 Adding installation and FAQ sections to the README 7 years ago
autoload.php 62f5bc002f Fixing autoload and bootstrapping now that we have a runtime dependency; Making PHP version requirements consistent 8 years ago
composer.json 9ab58be8eb Updating for PHP 7.2; Fixing tabs in composer.json 6 years ago
phpunit.xml a57ffe6014 Removing cruft from pre-Composer days 7 years ago

README.md

RNCryptor PHP

Build Status

This implementation strives to be fully compatible with Rob Napier's Objective-C implementation of RNCryptor. It supports both encryption and decryption of all RNCryptor schema versions through version 3. Due to security concerns with schemas 0 through 2, it is strongly recommended to use schema 3 wherever possible. This is the default if none is specified.

Basic usage is seen in the examples folder.

Installation

This library assumes you are using Composer for dependency management.

composer require rncryptor/rncryptor

If your project itself does not use Composer, then it's about time that it did. ;-) We strongly urge using it. Otherwise you will have to manually read composer.json and make sure the named dependencies are properly loaded into your project.

FAQ

It's complaining about a missing function called hash_pbkdf2

This error almost certainly means that this project's dependencies are not installed or being autoloaded properly. See the Installation section above for more.

It won't decrypt. The "+" on the sending end is getting turned into a " " on the receiving end.

This is usually due to passing an encrypted string into an HTTP request without taking care to encode it for HTTP first. It's because Base64 (which RNCryptor's encrypted strings are encoded in) sometimes includes the "+" character in its output, but this character has special meaning in HTTP encoding.

You can most likely solve this by passing the encrypted string through rawurlencode() on the sending end (or whatever is the equivalent for the language you are working with) before passing it into your HTTP request. And on the receiving end, you might need to use rawurldecode() on the string if your framework isn't already doing this for you.