<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
setasign / setapdf-signer-addon-azure-keyvault example snippets
$loader = new \Example\Psr4AutoloaderClass;
$loader->register();
$loader->addNamespace('setasign\SetaPDF\Signer\Module\AzureKeyVault', 'path/to/src/');
$httpClient = new GuzzleHttp\Client([
'http_errors' => false,
//'verify' => './cacert.pem'
]);
// if you are using php 7.1
//$httpClient = new Mjelamanov\GuzzlePsr18\Client($httpClient);
$azureModule = new setasign\SetaPDF\Signer\Module\AzureKeyVault\Module(
$vaultBaseUrl,
$certificateName,
$certificateVersion,
$httpClient,
new Http\Factory\Guzzle\RequestFactory(),
new Http\Factory\Guzzle\StreamFactory()
);
$token = $azureModule->createTokenBySharedSecret($tenantId, $appClientId, $appClientSecret);
$azureModule->setAccessToken($token['accessToken']);
// the file to sign
$fileToSign = __DIR__ . '/Laboratory-Report.pdf';
// create a writer instance
$writer = new SetaPDF_Core_Writer_File('signed.pdf');
// create the document instance
$document = SetaPDF_Core_Document::loadByFilename($fileToSign, $writer);
// create the signer instance
$signer = new SetaPDF_Signer($document);
$azureModule->setSignatureAlgorithm($alg);
$signer->sign($azureModule);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.