@@ -3,88 +3,85 @@ php-encryption
33
44[ ![ Build Status] ( https://travis-ci.org/defuse/php-encryption.svg?branch=master )] ( https://travis-ci.org/defuse/php-encryption )
55
6- This is a class for doing symmetric encryption in PHP. ** Requires PHP 5.4 or newer.**
6+ This is a library for encrypting data with a key or password in PHP. ** It
7+ requires PHP 5.4 or newer.** The current version is v2.0.0, which is expected to
8+ remain stable and supported by its authors with security and bugfixes until at
9+ least January 1st, 2019.
710
8- Implementation
9- --------------
11+ The library is a joint effort between [ Taylor Hornby] ( https://defuse.ca/ ) and
12+ [ Scott Arciszewski] ( https://paragonie.com/blog/author/scott-arcizewski ) as well
13+ as numerous open-source contributors.
1014
11- Messages are encrypted with AES-128 in CBC mode and are authenticated with
12- HMAC-SHA256 (Encrypt-then-Mac). PKCS7 padding is used to pad the message to
13- a multiple of the block size. HKDF is used to split the user-provided key into
14- two keys: one for encryption, and the other for authentication. It is
15- implemented using the ` openssl_ ` and ` hash_hmac ` functions.
15+ What separates this library from other PHP encryption libraries is, firstly,
16+ that it is secure. The authors used to encounter insecure PHP encryption code on
17+ a daily basis, so they created this library to bring more security to the
18+ ecosystem. Secondly, this library is "difficult to misuse." Like
19+ [ libsodium] ( https://github.com/jedisct1/libsodium ) , its API is designed to be
20+ easy to use in a secure way and hard to use in an insecure way.
1621
17- Audit Status
18- -------------
22+ Dependencies
23+ ------------
1924
20- This code has not been subjected to a formal, paid, security audit. However, it
21- has received some informal review from members of the PHP security community.
22-
23- As the author of this library, I take security very seriously and always opt to
24- not implement a feature unless I am confident that I can do so without
25- introducing security bugs. I take particular care to ensure the library is hard
26- to use in an insecure way, even by someone who is not experienced in
27- cryptography.
28-
29- This library considers many edge cases that most PHP encryption libraries do not
30- handle correctly. In all likelihood, you are safer using this library than
31- almost any other encryption library for PHP.
32-
33- If you use this library as a part of your business and would like to fund (or
34- help fund) a formal audit, I would be very grateful.
25+ This library requres no special dependencies except for PHP 5.4 or newer with
26+ the OpenSSL extensions enabled (this is the default). It uses
27+ [ random\_ compat] ( https://github.com/paragonie/random_compat ) , which is bundled
28+ in with this library so that your users will not need to follow any special
29+ installation steps.
3530
36- Philosophy
37- -----------
31+ Getting Started
32+ ----------------
3833
39- This library was created after noticing how much insecure PHP encryption code
40- there is. I once did a Google search for "php encryption" and found insecure
41- code or advice on 9 of the top 10 results .
34+ Start with the [ ** Tutorial ** ] ( docs/Tutorial.md ) . You can find instructions for
35+ obtaining this library's code securely in the [ Installing and
36+ Verifying ] ( docs/InstallingAndVerifying.md ) documentation .
4237
43- Encryption is becoming an essential component of modern websites. This library
44- aims to fulfil a subset of that need: Authenticated symmetric encryption of
45- short strings, given a random key.
38+ After you've read the tutorial and got the code, refer to the formal
39+ documentation for each of the classes this library provides:
4640
47- This library is developed around several core values:
41+ - [ Crypto] ( docs/classes/Crypto.md )
42+ - [ File] ( docs/classes/File.md )
43+ - [ Key] ( docs/classes/Key.md )
44+ - [ KeyProtectedByPassword] ( docs/classes/KeyProtectedByPassword.md )
4845
49- - Rule #1 : Security is prioritized over everything else.
46+ If you encounter difficulties, see the [ FAQ] ( docs/FAQ.md ) answers. The fixes to
47+ the most commonly-reported problems are explained there.
5048
51- > Whenever there is a conflict between security and some other property,
52- > security will be favored. For example, the library has runtime tests,
53- > which make it slower, but will hopefully stop it from encrypting stuff
54- > if the platform it's running on is broken.
49+ If you're a cryptographer and want to understand the nitty-gritty details of how
50+ this library works, look at the [ Cryptography Details] ( docs/CryptoDetails.md )
51+ documentation.
5552
56- - Rule #2 : It should be difficult to misuse the library.
53+ If you're interested in contributing to this library, see the [ Internal
54+ Developer Documentation] ( docs/InternalDeveloperDocs.md ) .
5755
58- > We assume the developers using this library have no experience with
59- > cryptography. We only assume that they know that the "key" is something
60- > you need to encrypt and decrypt the messages, and that it must be
61- > protected. Whenever possible, the library should refuse to encrypt or
62- > decrypt messages when it is not being used correctly.
56+ Examples
57+ ---------
6358
64- - Rule #3 : The library aims only to be compatible with itself.
59+ If the documentation is not enough for you to understand how to use this
60+ library, then you can look at an example project that uses this library:
6561
66- > Other PHP encryption libraries try to support every possible type of
67- > encryption, even the insecure ones (e.g. ECB mode). Because there are so
68- > many options, inexperienced developers must make decisions between
69- > things like "CBC" mode and "ECB" mode, knowing nothing about either one,
70- > which inevitably creates vulnerabilities.
62+ - [ encutil] ( https://github.com/defuse/encutil )
7163
72- > This library will only support one secure mode. A developer using this
73- > library will call "encrypt" and "decrypt" not caring about how they are
74- > implemented.
64+ Security Audit Status
65+ ---------------------
7566
76- - Rule #4 : The library should require no special installation.
67+ This code has not been subjected to a formal, paid, security audit. However, it
68+ has received lots of review from members of the PHP security community, and the
69+ authors are experienced with cryptography. In all likelihood, you are safer
70+ using this library than almost any other encryption library for PHP.
7771
78- > Some PHP encryption libraries, like libsodium-php [ 1] , are not
79- > straightforward to install and cannot packaged with "just download and
80- > extract" applications. This library will always be just a handful of PHP
81- > files that you can copy to your source tree and require().
72+ If you use this library as a part of your business and would like to help fund
73+ a formal audit, please [ contact Taylor Hornby] ( https://defuse.ca/contact.htm ) .
8274
83- References:
75+ Public Keys
76+ ------------
8477
85- [1] https://github.com/jedisct1/libsodium-php
78+ The GnuPG public key used to sign releases is available in
79+ [ other/signingkey.asc] ( other/signingkey.asc ) . Its fingerprint is:
8680
87- Authors
88- ---------
81+ ```
82+ 2FA6 1D8D 99B9 2658 6BAC 3D53 385E E055 A129 1538
83+ ```
8984
90- This library is authored by Taylor Hornby and Scott Arciszewski.
85+ You can verify it against the Taylor Hornby's [ contact
86+ page] ( https://defuse.ca/contact.htm ) and
87+ [ twitter] ( https://twitter.com/DefuseSec/status/723741424253059074 ) .
0 commit comments