PHP implementation of RNCryptor

Curtis Farnham fa3a72bead Removing php7.1 for now, and reverting composer.json mcrypt requirement 7 years ago
examples 62f5bc002f Fixing autoload and bootstrapping now that we have a runtime dependency; Making PHP version requirements consistent 8 years ago
lib 6bd84ea249 Key Based Decryption 8 years ago
tests 6b85ce24a9 Bugfix in strlen() in tests 7 years ago
tests-xcode d062d8fbc1 Fixes #72 Base64.h and Base64.m were in each others' files 11 years ago
vendor c7f5692f90 Adding reference to RNCryptor-Spec as a git submodule 10 years ago
.gitignore 7cede91524 Ignoring /vendor folder 8 years ago
.gitmodules c7f5692f90 Adding reference to RNCryptor-Spec as a git submodule 10 years ago
.travis.yml b643b91631 Removing php7.1 for now, and reverting composer.json mcrypt requirement 7 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 62b9052a5e Splitting RNCryptor.php into separate RNEncryptor.php and RNDecryptor.php files; Moving credits and licensing info for PHP impl out of the classes and into separate files 11 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 b643b91631 Removing php7.1 for now, and reverting composer.json mcrypt requirement 7 years ago
phpunit-coverage-html.xml 62f5bc002f Fixing autoload and bootstrapping now that we have a runtime dependency; Making PHP version requirements consistent 8 years ago
phpunit.xml 62f5bc002f Fixing autoload and bootstrapping now that we have a runtime dependency; Making PHP version requirements consistent 8 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.