All Projects → HavenShen → larsign

HavenShen / larsign

Licence: MIT license
Laravel signature certification with web API server.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to larsign

signature
HMAC and RSA signature for Laravel and Lumen
Stars: ✭ 26 (+44.44%)
Mutual labels:  signature, hmac
open-attestation
Meta framework for providing digital provenance and integrity to documents.
Stars: ✭ 39 (+116.67%)
Mutual labels:  signature
E Signature
A android signature library
Stars: ✭ 228 (+1166.67%)
Mutual labels:  signature
go-dkim
A Go library to create and verify DKIM signatures (migrated)
Stars: ✭ 38 (+111.11%)
Mutual labels:  signature
Expo Pixi
Tools for using pixi.js in Expo
Stars: ✭ 253 (+1305.56%)
Mutual labels:  signature
pdf-sign-check
A java / spring boot application to help you sign and check signed pdf documents
Stars: ✭ 81 (+350%)
Mutual labels:  signature
Creepycodecollection
A Nonsense Collection of Disgusting Codes
Stars: ✭ 2,206 (+12155.56%)
Mutual labels:  signature
memory signature
A small wrapper class providing an unified interface to search for various memory signatures
Stars: ✭ 69 (+283.33%)
Mutual labels:  signature
iOS-Signature-Capture
iOS-Signature-Capture is helps to capture the user signature with name and signed date in iOS and supports both Objective-c and Swift languages.
Stars: ✭ 50 (+177.78%)
Mutual labels:  signature
pbkdf2-hmac-sha256
sha256, hmac with sha256 and pbkdf2 with hmac-sha256 in one header file
Stars: ✭ 19 (+5.56%)
Mutual labels:  hmac
react-signature-canvas
A React wrapper component around signature_pad (in < 150 LoC). Unopinionated and heavily updated fork of react-signature-pad
Stars: ✭ 420 (+2233.33%)
Mutual labels:  signature
mitome.in
Explore OpenPGP and other cryptography as an alternative for seals (mitome-in)
Stars: ✭ 30 (+66.67%)
Mutual labels:  signature
leptin
🔗 Leptin is a PoW blockchain completely built in Nodejs.
Stars: ✭ 57 (+216.67%)
Mutual labels:  signature
Jsrsasign
The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES JSON Web Signature/Token in pure JavaScript.
Stars: ✭ 2,760 (+15233.33%)
Mutual labels:  signature
crypto
🔐 Fastest crypto library for Deno written in pure Typescript. AES, Blowfish, CAST5, DES, 3DES, HMAC, HKDF, PBKDF2
Stars: ✭ 40 (+122.22%)
Mutual labels:  hmac
Auth Jwt
A demo to learn JWT by reverse engineering
Stars: ✭ 208 (+1055.56%)
Mutual labels:  signature
eosdart ecc
Elliptic curve cryptography functions in Dart. Private Key, Public Key, Signature, AES, Encryption, Decryption
Stars: ✭ 25 (+38.89%)
Mutual labels:  signature
git-secure-tag
Secure git tag signing
Stars: ✭ 44 (+144.44%)
Mutual labels:  signature
SSL-TLS-ECDSA-timing-attack
Timing Attack on TLS' ECDSA signature
Stars: ✭ 41 (+127.78%)
Mutual labels:  signature
requests-http-signature
A Requests auth module for the IETF HTTP Message Signatures draft standard
Stars: ✭ 63 (+250%)
Mutual labels:  hmac

Api Authorized Signature Middleware for Laravel 5

Scrutinizer Code Quality Build Status Code Coverage Build Status Latest Stable Version Latest Unstable Version Latest Stable Version Total Downloads License

About

The larsign package authorized signature server.

Features

  • Handles larsign requests

Installation

Laravel

Require the havenshen/larsign package in your composer.json and update your dependencies:

$ composer require havenshen/larsign

Add the HavenShen\Larsign\LarsignServiceProvider to your config/app.php providers array:

HavenShen\Larsign\LarsignServiceProvider::class,

Add the HavenShen\Larsign\LarsignFacade to your config/app.php aliases array:

'Larsign' => HavenShen\Larsign\LarsignFacade::class,

Lumen

Require the havenshen/larsign package in your composer.json and update your dependencies:

$ composer require havenshen/larsign

Register the package with lumen in bootstrap/app.php with the following:

$app->register(HavenShen\Larsign\LarsignServiceProvider::class);

Global usage

To allow Larsign for all your routes, add the HandleLarsign middleware in the $middleware property of app/Http/Kernel.php class:

protected $middleware = [
    // ...
    \HavenShen\Larsign\HandleLarsign::class,
];

Group middleware

If you want to allow Larsign on a specific middleware group or route, add the HandleLarsign middleware to your group:

protected $middlewareGroups = [
    'web' => [
       // ...
    ],

    'api' => [
        // ...
        \HavenShen\Larsign\HandleLarsign::class,
    ],
];

Application route middleware

If you want to allow Larsign on a specific application middleware or route, add the HandleLarsign middleware to your application route:

protected $routeMiddleware = [
    // ...
    'auth.larsign' => \HavenShen\Larsign\HandleLarsign::class,
];

Configuration

The defaults are set in config/larsign.php. Copy this file to your own config directory to modify the values. If you're using Laravel, you can publish the config using this command:

$ php artisan vendor:publish --provider="HavenShen\Larsign\LarsignServiceProvider"

If you're using Lumen, Copy the configuration larsign.php from vendor/havenshen/larsign/config/larsign.php to your config/ directory

return [
    /*
     |--------------------------------------------------------------------------
     | Larsign
     |--------------------------------------------------------------------------
     |
     */
    'headerName' => env('LARSIGN_HEADER_NAME', 'Larsign'),
    'accessKey' => env('LARSIGN_ACCESS_KEY', ''),
    'secretKey' => env('LARSIGN_SECRET_KEY', ''),
];

Add api route in routes/api.php Copy this.

Route::middleware(['auth.larsign'])->group(function () {
    Route::get('/larsign', function () {
    return [
        'message' => 'done.'
    ]);
});

or

Route::get('/larsign', function () {
    return [
        'message' => 'done.'
    ];
})->middleware('auth.larsign');

Client

Generate Larsign signatures

  1. Assume the following management credentials:
AccessKey = "test"
SecretKey = "123456"
  1. Call interface address:
url = "https://larsign.dev/api/v1/test?page=1"
  1. The original string to be signed:

note: the time-stamping followed by a newline [currenttime + voucher valid seconds]

signingStr = "/api/v1/test?page=1\n1510986405"
  1. Base64 url safe encode:
signingStrBase64UrlSafeEncode = "L2FwaS92MS90ZXN0P3BhZ2U9MQoxNTEwOTg2NDY1"
  1. hmac_sha1 carries SecretKey encryption then base64 url safe encode:
sign = "MLKnFIdI-0TOQ4mHn5TyCcmWACU="
  1. The final administrative credentials are:

note: stitching headerName Space AccessKey:sign:signingStrBase64UrlSafeEncode

larsignToken = "Larsign test:MLKnFIdI-0TOQ4mHn5TyCcmWACU=:L2FwaS92MS90ZXN0P3BhZ2U9MQoxNTEwOTg2NDY1"
  1. Add http header:

note: header key in config/larsign.php -> headerName

Larsign:Larsign test:MLKnFIdI-0TOQ4mHn5TyCcmWACU=:L2FwaS92MS90ZXN0P3BhZ2U9MQoxNTEwOTg2NDY1

Client signature authorization failed

Http Response: 403

Testing

$ phpunit

License

The MIT License (MIT). Please see License File for more information.

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