Giter Club home page Giter Club logo

php-pdf-digital-signature's Introduction

PDF Generator with Digital Signature applied

How to setup & run

git clone [email protected]:harryosmar/php-pdf-digital-signature.git

cd php-pdf-digital-signature

composer install

# this will generate .pdf file in storage/logs/
php bin/console.php app:pdf-generate

Verify generated file pdf signature

Open https://account.ascertia.com/demos/PDFSignatureVerificationStep1 to verify the newly generated file

How the Digital Signature applied

# generate new .crt file, it's contained certificate & private key
openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout filename.crt -out filename.crt

# convert .crt to binar .p12 file
openssl pkcs12 -export -in tcpdf.crt -out filename.p12

# get private key from .p12 file, it will ask for passphrase/password, so the generated private key will be encrypted
openssl pkcs12 -in filename.p12 -nocerts -out filename.key

# get certificate from .p12 file
openssl pkcs12 -in filename.p12 -clcerts -nokeys -out filename.crt
<?php
/** @var TCPDF $pdf */
$pdf->setSignature('file://PATH-TO-CRT-FILE', 'file://PATH-TO-PRIVATE-KEY-FILE', 'PRIVATE-KEY-FILE-PASSPHRASE', '', 2, $info);

php-pdf-digital-signature's People

Contributors

harryosmar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

php-pdf-digital-signature's Issues

Error while generate PDF

Hi

I got this error while generating the PDF:

$ php bin/console.php app:pdf-generate
generate starting...
PHP Warning:  fopen(file://D:\xampp\htdocs\test-cert\bin/../storage/logs/example
_052.pdf): failed to open stream: No such file or directory in D:\xampp\htdocs\t
est-cert\vendor\tecnickcom\tcpdf\include\tcpdf_static.php on line 1821

Warning: fopen(file://D:\xampp\htdocs\test-cert\bin/../storage/logs/example_052.
pdf): failed to open stream: No such file or directory in D:\xampp\htdocs\test-c
ert\vendor\tecnickcom\tcpdf\include\tcpdf_static.php on line 1821
<strong>TCPDF ERROR: </strong>Unable to create output file: D:\xampp\htdocs\test
-cert\bin/../storage/logs/example_052.pdf

Could you update the code, pls?
Thanks in advance.

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.