Skip to content

Commit 9185b2d

Browse files
committed
Update version number to 2.2, docs to warn encryption doesn't hide length, version number check in release instructions, and specify a minimum OpenSSL version
1 parent 0cab897 commit 9185b2d

File tree

7 files changed

+87
-9
lines changed

7 files changed

+87
-9
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ php-encryption
88
[![Downloads](https://img.shields.io/packagist/dt/defuse/php-encryption.svg)](https://packagist.org/packages/defuse/php-encryption)
99

1010
This is a library for encrypting data with a key or password in PHP. **It
11-
requires PHP 5.4 or newer.** The current version is v2.0.0, which is expected to
12-
remain stable and supported by its authors with security and bugfixes until at
13-
least January 1st, 2019.
11+
requires PHP 5.6 or newer and OpenSSL 1.0.1 or newer.** The current version is
12+
v2.2.0, which is expected to remain stable and supported by its authors with
13+
security and bugfixes until at least January 1st, 2020.
1414

1515
The library is a joint effort between [Taylor Hornby](https://defuse.ca/) and
1616
[Scott Arciszewski](https://paragonie.com/blog/author/scott-arcizewski) as well
@@ -27,11 +27,11 @@ easy to use in a secure way and hard to use in an insecure way.
2727
Dependencies
2828
------------
2929

30-
This library requires no special dependencies except for PHP 5.4 or newer with
31-
the OpenSSL extensions enabled (this is the default). It uses
32-
[random\_compat](https://github.com/paragonie/random_compat), which is bundled
33-
in with this library so that your users will not need to follow any special
34-
installation steps.
30+
This library requires no special dependencies except for PHP 5.6 or newer with
31+
the OpenSSL extensions (version 1.0.1 or later) enabled (this is the default).
32+
It uses [random\_compat](https://github.com/paragonie/random_compat), which is
33+
bundled in with this library so that your users will not need to follow any
34+
special installation steps.
3535

3636
Getting Started
3737
----------------

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"require": {
2424
"paragonie/random_compat": "~2.0",
2525
"ext-openssl": "*",
26-
"php": ">=5.4.0"
26+
"php": ">=5.6.0"
2727
},
2828
"require-dev": {
2929
"phpunit/phpunit": "^4|^5",

docs/FAQ.md

+12
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,15 @@ If you're getting this exception, then the string you're giving to
3737
`loadFromAsciiSafeString()` is *not* the same as the string you got from
3838
`saveToAsciiSafeString()`. Perhaps your database column isn't wide enough and
3939
it's truncating the string as you insert it?
40+
41+
Does encrypting hide the length of the plaintext?
42+
--------------------------------------------------
43+
44+
Encryption does not, and is not intended to, hide the length of the data being
45+
encrypted. For example, it is not safe to encrypt a field in which only a small
46+
number of different-length values are possible (e.g. "male" or "female") since
47+
it would be possible to tell what the plaintext is by looking at the length of
48+
the ciphertext. In order to do this safely, it is your responsibility to, before
49+
encrypting, pad the data out to the length of the longest string that will ever
50+
be encrypted. This way, all plaintexts are the same length, and no information
51+
about the plaintext can be gleaned from the length of the ciphertext.

docs/InternalDeveloperDocs.md

+6
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ Check that the version number in composer.json is correct:
117117
cat composer.json
118118
```
119119

120+
Check that the version number in README.md is correct:
121+
122+
```
123+
cat README.md
124+
```
125+
120126
Run the tests:
121127

122128
```

docs/Tutorial.md

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ What this library provides is symmetric encryption for "data at rest." This
4646
means it is not suitable for use in building protocols where "data is in motion"
4747
(i.e. moving over a network) except in limited set of cases.
4848

49+
Please note that **encryption does not, and is not intended to, hide the
50+
*length* of the data being encrypted.** For example, it is not safe to encrypt
51+
a field in which only a small number of different-length values are possible
52+
(e.g. "male" or "female") since it would be possible to tell what the plaintext
53+
is by looking at the length of the ciphertext. In order to do this safely, it is
54+
your responsibility to, before encrypting, pad the data out to the length of the
55+
longest string that will ever be encrypted. This way, all plaintexts are the
56+
same length, and no information about the plaintext can be gleaned from the
57+
length of the ciphertext.
58+
4959
Getting the Code
5060
-----------------
5161

docs/classes/Crypto.md

+10
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ model the caller is designing their application under. If you are unsure where
5656
to store `$key`, consult with a professional cryptographer to get help designing
5757
your application.
5858

59+
Please note that **encryption does not, and is not intended to, hide the
60+
*length* of the data being encrypted.** For example, it is not safe to encrypt
61+
a field in which only a small number of different-length values are possible
62+
(e.g. "male" or "female") since it would be possible to tell what the plaintext
63+
is by looking at the length of the ciphertext. In order to do this safely, it is
64+
your responsibility to, before encrypting, pad the data out to the length of the
65+
longest string that will ever be encrypted. This way, all plaintexts are the
66+
same length, and no information about the plaintext can be gleaned from the
67+
length of the ciphertext.
68+
5969
### Crypto::decrypt($ciphertext, Key $key, $raw\_binary = false)
6070

6171
**Description:**

docs/classes/File.md

+40
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ caller is designing their application under. If you are unsure where to store
5252
`$key`, consult with a professional cryptographer to get help designing your
5353
application.
5454

55+
Please note that **encryption does not, and is not intended to, hide the
56+
*length* of the data being encrypted.** For example, it is not safe to encrypt
57+
a field in which only a small number of different-length values are possible
58+
(e.g. "male" or "female") since it would be possible to tell what the plaintext
59+
is by looking at the length of the ciphertext. In order to do this safely, it is
60+
your responsibility to, before encrypting, pad the data out to the length of the
61+
longest string that will ever be encrypted. This way, all plaintexts are the
62+
same length, and no information about the plaintext can be gleaned from the
63+
length of the ciphertext.
64+
5565
### File::decryptFile($inputFilename, $outputFilename, Key $key)
5666

5767
**Description:**
@@ -155,6 +165,16 @@ value of `$password` may be leaked out to an attacker through the stack trace.
155165
We recommend configuring PHP to never output stack traces (either displaying
156166
them to the user or saving them to log files).
157167

168+
Please note that **encryption does not, and is not intended to, hide the
169+
*length* of the data being encrypted.** For example, it is not safe to encrypt
170+
a field in which only a small number of different-length values are possible
171+
(e.g. "male" or "female") since it would be possible to tell what the plaintext
172+
is by looking at the length of the ciphertext. In order to do this safely, it is
173+
your responsibility to, before encrypting, pad the data out to the length of the
174+
longest string that will ever be encrypted. This way, all plaintexts are the
175+
same length, and no information about the plaintext can be gleaned from the
176+
length of the ciphertext.
177+
158178
### File::decryptFileWithPassword($inputFilename, $outputFilename, $password)
159179

160180
**Description:**
@@ -268,6 +288,16 @@ caller is designing their application under. If you are unsure where to store
268288
`$key`, consult with a professional cryptographer to get help designing your
269289
application.
270290

291+
Please note that **encryption does not, and is not intended to, hide the
292+
*length* of the data being encrypted.** For example, it is not safe to encrypt
293+
a field in which only a small number of different-length values are possible
294+
(e.g. "male" or "female") since it would be possible to tell what the plaintext
295+
is by looking at the length of the ciphertext. In order to do this safely, it is
296+
your responsibility to, before encrypting, pad the data out to the length of the
297+
longest string that will ever be encrypted. This way, all plaintexts are the
298+
same length, and no information about the plaintext can be gleaned from the
299+
length of the ciphertext.
300+
271301
### File::decryptResource($inputHandle, $outputHandle, Key $key)
272302

273303
**Description:**
@@ -374,6 +404,16 @@ value of `$password` may be leaked out to an attacker through the stack trace.
374404
We recommend configuring PHP to never output stack traces (either displaying
375405
them to the user or saving them to log files).
376406

407+
Please note that **encryption does not, and is not intended to, hide the
408+
*length* of the data being encrypted.** For example, it is not safe to encrypt
409+
a field in which only a small number of different-length values are possible
410+
(e.g. "male" or "female") since it would be possible to tell what the plaintext
411+
is by looking at the length of the ciphertext. In order to do this safely, it is
412+
your responsibility to, before encrypting, pad the data out to the length of the
413+
longest string that will ever be encrypted. This way, all plaintexts are the
414+
same length, and no information about the plaintext can be gleaned from the
415+
length of the ciphertext.
416+
377417
### File::decryptResourceWithPassword($inputHandle, $outputHandle, $password)
378418

379419
**Description:**

0 commit comments

Comments
 (0)