diff --git a/.travis.yml b/.travis.yml index 993c7ae..3205af2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +--- language: php php: - 7.0 @@ -48,4 +49,4 @@ matrix: - env: PHPSECLIB="2.0.6" fast_finish: true -before_script: 'sed -i "s/\"phpseclib\/phpseclib\": \"[^\"]*/\"phpseclib\/phpseclib\": \"$PHPSECLIB/" composer.json && composer install --prefer-source --dev' +before_script: 'sed -i "s/\"phpseclib\/phpseclib\": \"[^\"]*/\"phpseclib\/phpseclib\": \"$PHPSECLIB/" composer.json && composer install --prefer-source' diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..3f3c3b3 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,22 @@ +OpenPGP.php Examples +==================== + +The scripts in this folder show how to use this library to perform various tasks +such as [generating a new key](keygen.php), [signing a message](sign.php), and +[verifying a message](verify.php) that has been signed. + +To use these examples, make sure [`phpseclib`](http://phpseclib.sourceforge.net/) is available. You can install it +using [Composer](https://getcomposer.org/): + +```sh +git clone https://github.com/singpolyma/openpgp-php.git # Clone the repository. +cd openpgp-php +composer install # Use Composer to install the requirements. +``` + +Once Composer has installed the requirements, run the examples using PHP: + +```sh +# Generate a new OpenPGP key; see the `keygen.php` file for parameters. +php ./examples/keygen.php > mykey.gpg +``` diff --git a/examples/clearsign.php b/examples/clearsign.php index 686af02..1445fa7 100644 --- a/examples/clearsign.php +++ b/examples/clearsign.php @@ -1,5 +1,6 @@ data)."\n"; echo OpenPGP::enarmor($packets[1][0]->to_bytes(), "PGP SIGNATURE"); - -?> diff --git a/examples/deASCIIdeCrypt.php b/examples/deASCIIdeCrypt.php index 9ab6cdd..0326ba6 100644 --- a/examples/deASCIIdeCrypt.php +++ b/examples/deASCIIdeCrypt.php @@ -3,6 +3,7 @@ // USAGE: php examples/deASCIIdeCrypt.php secretkey.asc password message.asc // This will fail if the algo on key or message is not 3DES or AES +@include_once dirname(__FILE__).'/../vendor/autoload.php'; require_once dirname(__FILE__).'/../lib/openpgp.php'; require_once dirname(__FILE__).'/../lib/openpgp_crypt_rsa.php'; require_once dirname(__FILE__).'/../lib/openpgp_crypt_symmetric.php'; diff --git a/examples/encryptDecrypt.php b/examples/encryptDecrypt.php index 7804967..b9c1a52 100644 --- a/examples/encryptDecrypt.php +++ b/examples/encryptDecrypt.php @@ -1,5 +1,6 @@ sign($data); /* Output the raw message bytes to STDOUT */ echo $m->to_bytes(); - -?> diff --git a/examples/verify.php b/examples/verify.php index 8650199..b5cf5b4 100644 --- a/examples/verify.php +++ b/examples/verify.php @@ -1,5 +1,6 @@ verify($m)); - -?>