2017 © Pedro Peláez
 

symfony-bundle php_jwsign

This is a class of data encryption and decryption

image

yakeing/php_jwsign

This is a class of data encryption and decryption

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Json Wed Sign (RSA)

This is a function wrapping through the Openssl to sign and validate the data, which ensures the integrity and security of the original data., (*1)

Travis CI badge

Travis-ci, (*2)

codecov badge

codecov, (*3)

Github badge

Downloads Size tag license languages, (*4)

Installation

Use Composer to install the library. Of course, You can go to Packagist to view., (*5)


   $ composer require yakeing/php_jwsign

JWSign init


$jwsign = new jwsign(); $jwsign->SetPrivate($accesskey);

Get Pubkey


$Pubkey = $jwsign->GetPubkey(); var_dump($Pubkey); array(3) { ["pub"]=>string(451) "-----BEGIN PUBLIC KEY-----\nMIIBIjA....NjQIDAQA\n-----END PUBLIC KEY----" ["bits"]=>int(2048) ["kid"]=>string(43) "cjbdM-CeRfP...5BNYQuksIIgmk" }

Sign Message


$Message = base64_encode(' { "method":"pay", "charset":"utf-8", "version":"1.0", "token":"NAM...YgV" } '); $JsonStr = $jwsign->SignMessage($Message); var_dump($JsonStr); string(557) "{ "message":"eyJtZXRiO...Z1YifQ==", "nonce":"MmlhaDE1MD...MTgwLjEwNDc1OTAw", "kid":"cjOdM-CORfPGa...j-0I5BNYQuksIIgmk", "sign":"hXvBULK2wSroVFZ...-HYHG7l8Epixikg" }"

Pubkey Verify


$value = '{ "message":"eyJtZXRiO...Z1YifQ==", "nonce":"MmlhaDE1MD...MTgwLjEwNDc1OTAw", "kid":"cjOdM-CORfPGa...j-0I5BNYQuksIIgmk" }'; $sign = 'hXvBULK2wvSroVFZ...-HKbHGDYHG7l8Epixikg'; $pub = '-----BEGIN PUBLIC KEY-----\nMIIBIjA....NjQIDAQA\n-----END PUBLIC KEY----'; $Str = $jwsign->PubkeyVerify($value, $sign, $pub); var_dump($Str); bool(true)

Get Message


$value = '{ "message":"eyJtZXRiO...Z1YifQ==", "nonce":"MmlhaDE1MD...MTgwLjEwNDc1OTAw", "kid":"cjOdM-CORfPGa...j-0I5BNYQuksIIgmk" }'; $Str = json_decode($value, true); var_dump(base64_decode($Str['message'])); string(100) "{ "method":"pay", "charset":"utf-8", "version":"1.0", "token":"NAM...YgV" }"

Sponsor

If you've got value from any of the content which I have created, then I would very much appreciate your support by payment donate., (*6)

Sponsor, (*7)

Author

weibo: yakeing, (*8)

twitter: yakeing, (*9)

The Versions

26/05 2018

dev-master

9999999-dev https://github.com/yakeing/php_jwsign

This is a class of data encryption and decryption

  Sources   Download

MPL-2.0

The Requires

  • php >=5.6
  • ext-openssl *

 

The Development Requires

encryption rsa openssl decryption

16/08 2017

v1.2.0

1.2.0.0 https://github.com/yakeing/php_jwsign

This is a class of data encryption and decryption

  Sources   Download

MPL-2.0

The Requires

  • php >=5.6
  • ext-openssl *

 

The Development Requires

encryption rsa openssl decryption