Download the PHP package aarondfrancis/urlcrypt without Composer
On this page you can find all versions of the php package aarondfrancis/urlcrypt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aarondfrancis/urlcrypt
More information about aarondfrancis/urlcrypt
Files in aarondfrancis/urlcrypt
Package urlcrypt
Short Description PHP library to securely encode and decode short pieces of arbitrary binary data in URLs.
License MIT
Informations about the package urlcrypt
URLcrypt
Ever wanted to securely transmit (not too long) pieces of arbitrary binary data in a URL? URLcrypt makes it easy.
To read more about how it works, check out the blog post on the topic.
This class is based on the URLCrypt gem from Thomas Fuchs.
URLcrypt uses 256-bit AES symmetric encryption to securely encrypt data, and encodes and decodes Base 32 strings that can be used directly in URLs.
This can be used to securely store user ids, download expiration dates and other arbitrary data like that when you access a web application from a place that doesn't have other authentication or persistence mechanisms (like cookies):
- Loading a generated image from your web app in an email
- Links that come with an expiration date (à la S3)
- Mini-apps that don't persist data on the server
Important: As a general guideline, URL lengths shouldn't exceed about 2000 characters in length, as URLs longer than that will not work in some browsers and with some (proxy) servers. This limits the amount of data you should store with URLcrypt.
WORD OF WARNING: THERE IS NO GUARANTEE WHATSOEVER THAT THIS CLASS IS ACTUALLY SECURE AND WORKS. USE AT YOUR OWN RISK.
Patches are welcome; please include tests!
Requirements
URLcrypt requires PHP >= 5.3.3 as well as the mcrypt PHP extension.
Installation
You can install URLcrypt via Composer with composer require aarondfrancis/urlcrypt
or by adding the following to your composer.json
file:
Usage
Note that your key has to be a lower-case hex string.
Why not Base 64?
URLcrypt uses a modified Base 32 algorithm that doesn't use padding characters, and doesn't use vowels to avoid bad words in the generated string.
Base64 results in ugly URLs, since many characters need to be URL escaped.
Development
Clone the repository and do a composer install
in the root directory of the library to install the development dependencies.
Run the tests with phpunit
from the root directory.
License
This library is licensed under the MIT License - see the COPYING
file for details.
All versions of urlcrypt with dependencies
ext-mcrypt Version *