Skip to content

redfunction/php-xades-document

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XML Advanced Electronic Signatures Document

Installation

composer.json

{
    "require": {
      "bigbank/php-xades-document" : "0.1"
    }
}

Example code

Create ADoc file for preparing

<?php
use Bigbank\XadesDocument\ADoc;

$adoc = new ADoc();
$adoc->addDocument('agreement.pdf', 'this-document-content...');
$adoc->addAuthor('John Smith', 'Viru 4, Tallinn, Estonia', '10201');
$adoc->save('prepare.adoc');

Open ADoc file and put signature

<?php
use Bigbank\XadesDocument\ADoc;

$adoc = new ADoc('prepare.adoc');
$adoc->addPrepareSignature('x509-certificate-content...');
$requestSignatureHash = $adoc->getLastSignatureRequestHash(true);
$privateKeyId = openssl_pkey_get_private("private_key.pem");
openssl_sign($requestSignatureHash, $signatureData, $privateKeyId);
$adoc->setLastSignatureData($signatureData);
$adoc->save('signed.adoc');

Append ADoc

<?php
use Bigbank\XadesDocument\ADoc;

$adoc = new ADoc('first.adoc');
$adoc->appendFileOrContent('second.adoc');
$adoc->save('appended.adoc');

About

PHP library for generating adoc file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%