Skip to content

Instantly share code, notes, and snippets.

🚲
Ridding

Florent Morselli Spomky

🚲
Ridding
Block or report user

Report or block Spomky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Signature algorithms - 2017-09-21.md

Jose Performance Test Suite

suite: 133c8a9a843fad997c79f19106136b23269c56fc, date: 2017-09-21, stime: 23:54:29

subject groups revs best mean mode worst params
sign JWS,EdDSA,Ed25519 4096 293.045μs 293.045μs 293.045μs 293.045μs {"algorithm":"EdDSA"}
verify JWS,EdDSA,Ed25519 4096 398.441μs 398.441μs 398.441μs 398.441μs {"input":"eyJhbGciOiJFZERTQSJ9.SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4gWW91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBkb24ndCBrZWVwIHlvdXIgZmVldCwgdGhlcmXigJlzIG5vIGtub3dpbmcgd2hlcmUgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4.zwhKxTMnLVgl0KSn9GT2ongThN0hOZkp046k3S296_TKwAXZH3n4OGMavgUgmuhXER3_zRz-nBqJMfUDIoRHBQ"}
sign JWS,ECDSA,ES256 4096 1,676.358μs 1,676.358μs 1,676.358μs 1,676.358μs {"algorithm":"ES256"}
View truncate.php
<?php
function truncate($value, $length = 30, $preserve = false, $separator = '...')
{
if ($length < strlen($value)) {
if (true === $preserve) {
if (false === ($breakpoint = strpos($value, ' ', $length))) {
return $value;
}
$length = $breakpoint;
@Spomky
Spomky / 2017-08-11_15-08-30.md
Last active Aug 11, 2017
Jose Library Performance Reports
View 2017-08-11_15-08-30.md

Jose Performance Test Suite

suite: 133c83be6080429a71d966ecec21128d31dd5692, date: 2017-08-11, stime: 15:08:30

benchmark groups subject mean best worst params
A128GCMKWBench JWE,A128GCMKW benchEncryption 193.550μs 193.550μs 193.550μs {"payload":"It\u2019s a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there\u2019s no knowing where you might be swept off to.","shared_protected_headers":{"alg":"A128GCMKW","enc":"A128CBC-HS256"},"shared_headers":[],"recipient_headers":[],"recipient_key":{"kty":"oct","k":"GZy6sIZ6wl9NJOKB-jnmVQ"}}
A128GCMKWBench JWE,A128GCMKW benchEncryption 191.550μs 191.550μs 191.550μs {"payload":"It\u2019s a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there\u2019s no knowing where you might be swept off to.","shared_protected_headers":{"alg":"A128GCMKW","enc":"A192
@Spomky
Spomky / ECDH-ES.md
Last active Aug 9, 2017
Performance Test Report
View ECDH-ES.md

Jose Performance Test Suite

suite: 133c83918c0211f8eb71010e6d5b9ee5bf6851e1, date: 2017-08-09, stime: 23:53:25

Only for ECDH-ES encryption process.

benchmark groups subject params mean best worst
ECDHESBench JWE,ECDHES benchEncryption {"payload":"It\u2019s a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there\u2019s no knowing where you might be swept off to.","shared_protected_headers":{"alg":"ECDH-ES","enc":"A128CBC-HS256"},"shared_headers":[],"recipient_headers":[],"recipient_key":{"crv":"P-256","kty":"EC","x":"Kuh77MGkweIENgR_3WjzJ4gEF47yn6yQWAeeNqYC5qo","y":"1koAqIfb5C2PkCT1GYEcW4IcIEdrgOdMcua6G0Eyhtc"}} 37,363.520μs 37,363.520μs 37,363.520μs
@Spomky
Spomky / apn.php
Last active Jun 10, 2018
Generate JWT for Apple Push Notification
View apn.php
<?php
require_once 'vendor/autoload.php';
use Jose\Factory\JWKFactory;
use Jose\Factory\JWSFactory;
$key_file = '/PATH/TO/KEY/FILE';
$secret = null; // If the key is encrypted, the secret must be set in this variable
View JWTDecodeFailureException.php
<?php
namespace Lexik\Bundle\JWTAuthenticationBundle\Exception;
/**
* Base class for exceptions thrown during JWTEncoderInterface::decode().
*
* @author Robin Chalas <robin.chalas@gmail.com>
*/
class JWTDecodeFailureException extends JWTFailureException
@Spomky
Spomky / ClientInterface.php
Last active Jan 31, 2018
Secured Resource Owner Password Credentials Grant Type (proof of concept)
View ClientInterface.php
<?php
// src/Acme/ApiBundle/OAuth/SROCGrantType.php
namespace Acme\ApiBundle\OAuth;
use FOS\OAuthServerBundle\Storage\GrantExtensionInterface;
use OAuth2\Model\IOAuth2Client;
/**
View composer.json
{
"name": "my/example",
"require": {
"spomky-labs/jose-service": "~0.0.6"
},
"authors": [
{
"name": "John Smith",
"email": "john@example.com"
}
View composer.json
{
"name": "test",
"description": "TOTP test",
"require": {
"spomky-labs/otphp": "~4.0"
}
}
View Simple benchmark
<?php
require_once("vendor/autoload.php");
use Base64Url\Base64Url;
use MIME\Base64URLSafe;
$test = "Hello world";
$time_start = microtime(true);
You can’t perform that action at this time.