PHP JOSE (Javascript Object Signing and Encryption) Implementation
phpseclib is required. http://phpseclib.sourceforge.net
$jwt = new JOSE_JWT(array(
'foo' => 'bar'
));
$jwt->toString();
$jwt_string = 'eyJ...';
$jwt = JOSE_JWT::decode($jwt_string);
$private_key = "-----BEGIN RSA PRIVATE KEY-----\n....";
$jwt = new JOSE_JWT(array(
'foo' => 'bar'
));
$jws = $jwt->sign($private_key, 'RS256');
$public_key = "-----BEGIN RSA PUBLIC KEY-----\n....";
$jwt_string = 'eyJ...';
$jwt = JOSE_JWT::decode($jwt_string);
$jws = new JOSE_JWS($jwt);
$jws->verify($public_key);
not supported yet
$jwt_string = 'eyJ...';
$jwt = JOSE_JWT::decode($jwt_string);
$jwt->decrypt($private_key);
git clone git://github.com/gree/jose.git
cd jose
php composer.phar install --dev
./vendor/bin/phpunit -c test/phpunit.xml --tap
Copyright © 2013 GREE Inc. See LICENSE for details.