From bb4e0e828de358f0d1ead46bd1e508437e81905a Mon Sep 17 00:00:00 2001 From: Christopher Eskow Date: Tue, 25 Apr 2017 16:34:47 -0400 Subject: [PATCH 1/2] Add command line script for generating new keys --- bin/generate-defuse-key | 14 ++++++++++++++ composer.json | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 bin/generate-defuse-key diff --git a/bin/generate-defuse-key b/bin/generate-defuse-key new file mode 100755 index 0000000..24e31b5 --- /dev/null +++ b/bin/generate-defuse-key @@ -0,0 +1,14 @@ +#!/usr/bin/env php +saveToAsciiSafeString(), "\n"; diff --git a/composer.json b/composer.json index b02eb21..ca54af5 100644 --- a/composer.json +++ b/composer.json @@ -27,5 +27,8 @@ }, "require-dev": { "nikic/php-parser": "^2.0" - } + }, + "bin": [ + "bin/generate-defuse-key" + ] } From 4dfdd8db21068c98f38d227ece2837d3e2462625 Mon Sep 17 00:00:00 2001 From: Christopher Eskow Date: Tue, 25 Apr 2017 17:01:57 -0400 Subject: [PATCH 2/2] Update the tutorial with reference to new key-generating script --- docs/Tutorial.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/docs/Tutorial.md b/docs/Tutorial.md index e5d8b68..40285cc 100644 --- a/docs/Tutorial.md +++ b/docs/Tutorial.md @@ -100,17 +100,12 @@ Eve is a good database administrator, but she might have incentive to steal the data from the database. They want to keep some of the web application's data secret from Eve. -In order to do that, Alice will write a script that generates a random -encryption key and prints it to standard output: - -```php -saveToAsciiSafeString(); +In order to do that, Alice will use the included `generate-defuse-key` script +which generates a random encryption key and prints it to standard output: +```sh +$ composer require defuse/php-encryption +$ vendor/bin/generate-defuse-key ``` Alice will run this script once and save the output to a configuration file, say