Skip to content

Commit 1ba1585

Browse files
committed
use spomky-labs/php-aes-gcm (thanks @Spomky-Labs)
instead of the bigger spomky-labs/jose
1 parent 5de72ea commit 1ba1585

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
If you have a PHP version smaller than 5.5.9, you will not be able to send any payload.
1111

12-
If you have a PHP version smaller than 7.1, you will have to `composer require spomky-labs/jose:2.0.x-dev`.
13-
1412
## Usage
1513
WebPush can be used to send notifications to endpoints which server delivers web push notifications as described in
1614
the [Web Push protocol](https://tools.ietf.org/html/draft-thomson-webpush-protocol-00).
@@ -177,7 +175,7 @@ using the user public key and authentication secret that you can get by followin
177175
Internally, WebPush uses the [phpecc](https://github.com/phpecc/phpecc) Elliptic Curve Cryptography library to create
178176
local public and private keys and compute the shared secret.
179177
Then, if you have a PHP >= 7.1, WebPush uses `openssl` in order to encrypt the payload with the encryption key.
180-
It uses [jose](https://github.com/Spomky-Labs/jose) if you have PHP < 7.1, which is slower.
178+
Otherwise, it uses [Spomky-Labs/php-aes-gcm](https://github.com/Spomky-Labs/php-aes-gcm) if you have PHP < 7.1, which is slower.
181179

182180
### How to solve "SSL certificate problem: unable to get local issuer certificate" ?
183181
Your installation lacks some certificates.

composer.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@
1717
"kriswallsmith/buzz": ">=0.6",
1818
"mdanter/ecc": "^0.3.0",
1919
"lib-openssl": "*",
20-
"spomky-labs/base64url": "^1.0"
20+
"spomky-labs/base64url": "^1.0",
21+
"spomky-labs/php-aes-gcm": "^1.0"
2122
},
2223
"require-dev": {
23-
"phpunit/phpunit": "4.8.*",
24-
"spomky-labs/jose": "2.0.x-dev"
25-
},
26-
"suggest": {
27-
"spomky-labs/jose:2.0.x-dev": "Payload support if you have 5.5.9 <= PHP version < 7.1"
24+
"phpunit/phpunit": "4.8.*"
2825
},
2926
"autoload": {
3027
"psr-4" : {

src/Encryption.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function encrypt($payload, $userPublicKey, $userAuthToken, $native
8484
// encrypt
8585
// "The additional data passed to each invocation of AEAD_AES_128_GCM is a zero-length octet sequence."
8686
if (!$nativeEncryption) {
87-
list($encryptedText, $tag) = \Jose\Util\GCM::encrypt($contentEncryptionKey, $nonce, $payload, "");
87+
list($encryptedText, $tag) = \AESGCM\AESGCM::encrypt($contentEncryptionKey, $nonce, $payload, "");
8888
} else {
8989
$encryptedText = openssl_encrypt($payload, 'aes-128-gcm', $contentEncryptionKey, OPENSSL_RAW_DATA, $nonce, $tag); // base 64 encoded
9090
}

0 commit comments

Comments
 (0)