2017 © Pedro PelĆ”ez
 

library certsign

PHP Library for CertSign by CertEurope

image

ylly/certsign

PHP Library for CertSign by CertEurope

  • Thursday, June 28, 2018
  • by mickaelblondeau
  • Repository
  • 3 Watchers
  • 2 Stars
  • 42 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 16 Versions
  • 133 % Grown

The README.md

CertSign PHP library

This library allows you to easily implement CertSign by CertEurope into your project., (*1)

Build Status, (*2)

Require :

  • PHP 5.4+
  • PHP CURL
  • PHP GD
  • PHP compiled with FreeType support, else the provided image generation service will fallback to standard text

Limitations :

  • Only SYNC sign mode is implemented

Installation :

composer require ylly/certsign

Usage :

Convert the certificate

This library use a PEM certificate, as CertSign provide a P12 file, you need to convert this certificate into the PEM, (*3)

You will need to enter the certificate's password (you can use the -passin 'pass:my_password' argument), (*4)

openssl pkcs12 -in cert.p12 -out cert.pem

Create a signator

The signator manage authentication and signature, (*5)

You can create a signator from a YAML config file, (*6)

$signator = SignatorFactory::createFromYamlFile('/path/to/config.yml');

Or from an key-value array of configuration, (*7)

$signator = SignatorFactory::createFromArray($configArray);

Fill user informations and documents

The users informations and documents are stored in a signature request, (*8)

$signature = Signature::create()->setImage('/path/to/sign.png', false);
//$signature = Signature::create()->setImage('BASE64');
//$signature = Signature::create()->setImage(new Image(...));

$request = Request::create()
    ->setHolder('Firstname', 'Lastname', 'certsign@ylly.fr', '0601020304')
    ->addDocument('Document-1', '/path/to/doc.pdf', $signature, false)
    ->addDocument('Document-2', 'BASE64', $signature);

Sign documents

You have two ways to sign documents, with or without authentication, (*9)

The authentication can be handled by email or SMS, (*10)

With authentication (OTP)

$request->setOTP('0601020304'); // Will send a SMS
//$request->setOTP('certsign@ylly.fr'); // Will send an Email

// Generate the order, returns the order ID
$orderId = $signator->createOrder($request);

// Send the OTP, can be reused to generate a new OTP
$signator->validate($orderId);

// Create the signature request with the documents and signature image
$signator->createRequest($request, $orderId);

// Enter OTP given by SMS or Email, will return false if the code is invalid
// Returns the signed documents
$documents = $signator->sign($orderId, 'MyOTP');

Without authentication (Direct sign)

// Generate the order, returns the order ID
$orderId = $signator->createOrder($request);

// Create the signature request with the documents and signature image
$signator->createRequest($request, $orderId);

// Returns the signed documents
$documents = $signator->sign($orderId);

Configuration file :

env: test # or prod
cert: /etc/ssl/certsign.pem
cert_password: password
proxy: locahost:8080 # optionnal web proxy

Advanced usage :

A Log interface is provided to manage outputed logs, you can register your listener on the signator, (*11)

class Listener implement LogListenerInterface
{
    public function recieve($level, $message)
    {
        // do something
    }
}

$signator->addListener(new Listener());

Instead of using a static image, you can generate a simple image using the following scripts :, (*12)

$image = new Image(100, 50, new Color(255, 255, 255));
$image->setStyle(new TextStyle(0, 0, 12, 2, new Color(0, 0, 0));
$image->addText('SignText');

The Versions

28/06 2018

dev-master

9999999-dev

PHP Library for CertSign by CertEurope

  Sources   Download

MIT

The Requires

 

The Development Requires

28/06 2018

1.5.3

1.5.3.0

PHP Library for CertSign by CertEurope

  Sources   Download

MIT

The Requires

 

The Development Requires

28/06 2018

1.5.2

1.5.2.0

PHP Library for CertSign by CertEurope

  Sources   Download

MIT

The Requires

 

The Development Requires

23/02 2018

1.5.1

1.5.1.0

PHP Library for CertSign by CertEurope

  Sources   Download

MIT

The Requires

 

The Development Requires

23/02 2018

1.5.0

1.5.0.0

PHP Library for CertSign by CertEurope

  Sources   Download

MIT

The Requires

 

The Development Requires

21/02 2018

1.4.0

1.4.0.0

PHP Library for CertSign by CertEurope

  Sources   Download

MIT

The Requires

 

The Development Requires

31/01 2018

1.3.0

1.3.0.0

PHP Library for CertSign by CertEurope

  Sources   Download

MIT

The Requires

 

The Development Requires

24/10 2017

1.2.0

1.2.0.0

  Sources   Download

The Requires

 

The Development Requires

23/10 2017

1.1.6

1.1.6.0

  Sources   Download

The Requires

 

The Development Requires

25/09 2017

1.1.5

1.1.5.0

  Sources   Download

The Requires

 

The Development Requires

21/09 2017

1.1.4

1.1.4.0

  Sources   Download

The Requires

 

The Development Requires

21/09 2017

1.1.3

1.1.3.0

  Sources   Download

The Requires

 

The Development Requires

21/09 2017

1.1.2

1.1.2.0

  Sources   Download

The Requires

 

The Development Requires

21/09 2017

1.1.1

1.1.1.0

  Sources   Download

The Requires

 

The Development Requires

15/09 2017

1.1.0

1.1.0.0

  Sources   Download

The Requires

 

The Development Requires

14/09 2017

1.0.0

1.0.0.0

  Sources   Download

The Requires

 

The Development Requires