All Projects → yakeing → php_jwsign

yakeing / php_jwsign

Licence: MPL-2.0 license
This is a function wrapping through the Openssl to sign and validate the data, which ensures the integrity and security of the original data.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php jwsign

apple-pay
This library is used to decode tokens for Apple Pay.
Stars: ✭ 38 (+15.15%)
Mutual labels:  openssl, decryption
cryptocli
The ultimate tool for data transfer, manipulation and proxy.
Stars: ✭ 16 (-51.52%)
Mutual labels:  openssl, decryption
Underlock
Underlock makes it dead simple to encrypt and decrypt your data and files. It comes with little to no dependencies and has a very small API surface.
Stars: ✭ 128 (+287.88%)
Mutual labels:  openssl, decryption
WebCrypto.swift
A small collection of cryptographic functions based on the JavaScript WebCrypto API.
Stars: ✭ 16 (-51.52%)
Mutual labels:  openssl, decryption
Gonnacry
A Linux Ransomware
Stars: ✭ 341 (+933.33%)
Mutual labels:  openssl, decryption
Cryptr
A simple shell utility for encrypting and decrypting files using OpenSSL.
Stars: ✭ 81 (+145.45%)
Mutual labels:  openssl, decryption
Openssl
TLS/SSL and crypto library
Stars: ✭ 17,157 (+51890.91%)
Mutual labels:  openssl, decryption
Lua Openssl
Openssl binding for Lua
Stars: ✭ 206 (+524.24%)
Mutual labels:  openssl
spki
A bash script wrapper for OpenSSL that generates and manages a simple PKI suitable for small deployments
Stars: ✭ 39 (+18.18%)
Mutual labels:  openssl
Openssl Osx Ca
Simple periodic task to sync OSX Keychain certs to Homebrew installed OpenSSL & LibreSSL
Stars: ✭ 185 (+460.61%)
Mutual labels:  openssl
Bluecryptor
Swift cross-platform crypto library using CommonCrypto/libcrypto
Stars: ✭ 171 (+418.18%)
Mutual labels:  openssl
Armor
Armor is a simple Bash script designed to create encrypted macOS payloads capable of evading antivirus scanners.
Stars: ✭ 228 (+590.91%)
Mutual labels:  openssl
ciphr
CLI crypto swiss-army knife for performing and composing encoding, decoding, encryption, decryption, hashing, and other various cryptographic operations on streams of data from the command line; mostly intended for ad hoc, infosec-related uses.
Stars: ✭ 100 (+203.03%)
Mutual labels:  decryption
Self Signed Ssl
Generate self-signed TLS certificate using OpenSSL
Stars: ✭ 188 (+469.7%)
Mutual labels:  openssl
client-encryption-nodejs
Library for Mastercard API compliant payload encryption/decryption.
Stars: ✭ 20 (-39.39%)
Mutual labels:  decryption
Openssl For Iphone
A script for compiling OpenSSL for iOS Devices (iPhone, iPad, iPod Touch, AppleTV, MacCatalyst)
Stars: ✭ 2,190 (+6536.36%)
Mutual labels:  openssl
OpenSSL
Swift modulemaps for libSSL and libcrypto
Stars: ✭ 57 (+72.73%)
Mutual labels:  openssl
strong-cryptor
Strong encryption and decryption node js
Stars: ✭ 18 (-45.45%)
Mutual labels:  decryption
Check ssl cert
check_ssl_cert is a shell script (that can be used as a Nagios plugin) to check the CA and validity of an X.509 certificate
Stars: ✭ 248 (+651.52%)
Mutual labels:  openssl
Lagrange
A Beautiful Gemini Client
Stars: ✭ 238 (+621.21%)
Mutual labels:  openssl

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.

Travis CI badge

Travis-ci

codecov badge

codecov

Github badge

Downloads Size tag license languages

Installation

Use Composer to install the library. Of course, You can go to Packagist to view.


    $ 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.

Sponsor

Author

weibo: yakeing

twitter: yakeing

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].