Giter Site home page Giter Site logo

euspe's Introduction

euspe

CI workflow

OOP interfaces for the EUSign PHP library. The eusphpe extension is included in releases.

Usage

Similar to euspe_* functions, but with OOP interfaces.

Decrypt signed data:

$crypto = new Matasar\Euspe\Crypto(); // initializes the library

// similar to EUSignTest.php \develop()
$result = $crypto->develop('path/to/private_key', 'password', 'encrypted_data');
var_dump($result->signInfo->data); // decrypted data

Hash data for signing:

$crypto = new Matasar\Euspe\Crypto();

$hash = $crypto->hash('path/to/file', true); // hash a file
var_dump(base64_encode($hash));

$hash = $crypto->hash('qwerty', false); // hash a string
var_dump(base64_encode($hash));

Tests and development

The tests should not and don't do any real cryptography testing, as this is only a wrapper for the library.

  1. Install vendors
docker run --rm -v $(pwd):/app -w /app composer:lts composer install --ignore-platform-reqs

Important

The --ignore-platform-reqs flag is required to avoid the ext-eusphpe requirement.

  1. Run tests
docker run --rm -v $(pwd):/app -w /app composer:lts vendor/bin/phpunit

Recommendations to install the EUSign library

  1. Unpack and copy library files:
cp .../eusphpe.ini /etc/php/7.4/mods-available/eusphpe.ini
cp -R .../eusphpe_extension /usr/lib/php/eusphpe_extension
  1. Make symlinks to the configuration file:
ln -s /etc/php/7.4/mods-available/eusphpe.ini /etc/php/7.4/fpm/conf.d/20-eusphpe.ini
ln -s /etc/php/7.4/mods-available/eusphpe.ini /etc/php/7.4/cli/conf.d/20-eusphpe.ini
  1. Restart the FPM service
  2. If you have certificates install them (by default in /data/certificates, see osplm.ini):
ls -la /data/certificates/
-rw-rw-r-- 1 root root 876543 Feb 24 2022 CACertificates.p7b
-rw-rw-r-- 1 root root  12345 Feb 24 2022 CAs.json
-rw-rw-r-- 1 root root   1234 Feb 24 2022 EU-xxxxxx.cer
-rw-rw-r-- 1 root root   1234 Feb 24 2022 EU-xxxxxx.cer

Important

You will likely need the original osplm.ini file and not the one which provided with the library demo. The eusphpe extension is compiled for x86_64 architecture, so it can't run on ARM natively.

euspe's People

Contributors

matasarei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.