{"id":18765311,"url":"https://github.com/setasign/setapdf-signer-addon-globalsign-dss","last_synced_at":"2025-10-26T14:43:47.144Z","repository":{"id":37587821,"uuid":"159180668","full_name":"Setasign/SetaPDF-Signer-Addon-GlobalSign-DSS","owner":"Setasign","description":"A SetaPDF-Signer component signature module for the GlobalSign Digital Signing Service.","archived":false,"fork":false,"pushed_at":"2025-04-08T12:14:24.000Z","size":276,"stargazers_count":6,"open_issues_count":4,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T21:08:54.165Z","etag":null,"topics":["digital-signature","globalsign","pades","pdf","php","setapdf","setapdf-signer","signature"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Setasign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-26T14:16:29.000Z","updated_at":"2025-04-08T12:14:28.000Z","dependencies_parsed_at":"2022-08-25T13:12:06.588Z","dependency_job_id":"c09947d9-433c-4404-b4ac-d3ca90f5dacb","html_url":"https://github.com/Setasign/SetaPDF-Signer-Addon-GlobalSign-DSS","commit_stats":{"total_commits":25,"total_committers":5,"mean_commits":5.0,"dds":0.4,"last_synced_commit":"731b785ee569d7c3d9e0599a656c2ca0d50746c2"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Setasign%2FSetaPDF-Signer-Addon-GlobalSign-DSS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Setasign%2FSetaPDF-Signer-Addon-GlobalSign-DSS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Setasign%2FSetaPDF-Signer-Addon-GlobalSign-DSS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Setasign%2FSetaPDF-Signer-Addon-GlobalSign-DSS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Setasign","download_url":"https://codeload.github.com/Setasign/SetaPDF-Signer-Addon-GlobalSign-DSS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665746,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["digital-signature","globalsign","pades","pdf","php","setapdf","setapdf-signer","signature"],"created_at":"2024-11-07T18:33:32.651Z","updated_at":"2025-10-19T08:26:55.803Z","avatar_url":"https://github.com/Setasign.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SetaPDF-Signer component modules for the GlobalSign Digital Signing Service.\n\nThis package offers modules for the [SetaPDF-Signer](https://www.setasign.com/signer) component that allow you \nto use the [Cloud-based Digital Signing Service](https://www.globalsign.com/en/digital-signatures/cloud/) by\n[GlobalSign](https://www.globalsign.com) to **digital sign and timestamp PDF documents in pure PHP**.\n\n## Requirements\n\nTo use this package you need credentials for the GlobalSign Digital Signing Service which are:\n\n1. Your private key\n2. Client certificate for mTLS connection to the API\n3. Your API key and password\n\nSee \"GlobalSign-Digital-Signing-Service-Guide 1.3.pdf\" (or newer) for details. Ask a GlobalSign contact for this document. \n\nThis package is developed and tested on PHP \u003e= 7.1. Requirements of the [SetaPDF-Signer](https://www.setasign.com/signer) \ncomponent can be found [here](https://manuals.setasign.com/setapdf-signer-manual/getting-started/#index-1).\n\nWe're using [PSR-17 (HTTP Factories)](https://www.php-fig.org/psr/psr-17/) and\n[PSR-18 (HTTP Client)](https://www.php-fig.org/psr/psr-18/) for the requests. So you'll need an implementation of\nthese. We recommend using Guzzle.\n\n### For PHP 7.1\n```\n    \"require\" : {\n        \"guzzlehttp/guzzle\": \"^6.5\",\n        \"http-interop/http-factory-guzzle\": \"^1.0\",\n        \"mjelamanov/psr18-guzzle\": \"^1.3\"\n    }\n```\n\n### For \u003e= PHP 7.2\n```\n    \"require\" : {\n        \"guzzlehttp/guzzle\": \"^7.0\",\n        \"http-interop/http-factory-guzzle\": \"^1.0\"\n    }\n```\n\n## Installation\nAdd following to your composer.json:\n\n```json\n{\n    \"require\": {\n        \"setasign/seta-pdf-signer-addon-global-sign-dss\": \"^2.0\"\n    },\n    \"repositories\": [\n        {\n            \"type\": \"composer\",\n            \"url\": \"https://www.setasign.com/downloads/\"\n        }\n    ]\n}\n```\n\nand execute `composer update`. You need to define the `repository` to evaluate the dependency to the \n[SetaPDF-Signer](https://www.setasign.com/signer) component (see \n[here](https://getcomposer.org/doc/faqs/why-can%27t-composer-load-repositories-recursively.md) for more details).\n\n### Evaluation version\nBy default, this packages depends on a licensed version of the [SetaPDF-Signer](https://www.setasign.com/signer) component.\nIf you want to use it with an evaluation version please use following in your composer.json:\n\n```json\n{\n    \"require\": {\n        \"setasign/seta-pdf-signer-addon-global-sign-dss\": \"dev-evaluation\"\n    },\n    \"repositories\": [\n        {\n            \"type\": \"composer\",\n            \"url\": \"https://www.setasign.com/downloads/\"\n        }\n    ]\n}\n```\n\n## Usage\n\nAll classes in this package are located in the namespace `setasign\\SetaPDF\\Signer\\Module\\GlobalSign\\Dss`.\n\n### The `Client` class\n\nThere's a simple `Client` class which wraps the [REST API](https://downloads.globalsign.com/acton/media/2674/digital-signing-service-api-documentation) \ninto  simple PHP methods. It handles the authentication, requests and responses internally.\n\nThe constructor of this class requires the following arguments: \n\n- `$httpClient` PSR-18 HTTP Client implementation.\n- `$requestFactory` PSR-17 HTTP Factory implementation.\n- `$streamFactory` PSR-17 HTTP Factory implementation.\n- `$apiKey` is your API key received from GlobalSign.\n- `$apiSecret` is the secret to your API key received from GlobalSign.\n\nA common creation could look like:\n\n```php\n$options = [\n    'http_errors' =\u003e false, // recommended for guzzle - because of PSR-18\n    'cert' =\u003e 'path/to/tls-cert.pem',\n    'ssl_key' =\u003e 'path/to/private/key.pem'  \n];\n\n$apiKey = 'xxxxxxxxxxxxxxxx';\n$apiSecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';\n\n$httpClient = new GuzzleHttp\\Client($options);\n// if you are using php 7.0 or 7.1\n//$httpClient = new Mjelamanov\\GuzzlePsr18\\Client($httpClient);\n$requestFactory = new Http\\Factory\\Guzzle\\RequestFactory();\n$streamFactory = new Http\\Factory\\Guzzle\\StreamFactory();\n\n$client = new Dss\\Client($httpClient, $requestFactory, $streamFactory, $apiKey, $apiSecret);\n```\n\nYou can use this instance to e.g. query general information:\n\n```php\n$remainingSignatures = $client-\u003egetQuota(Dss\\Client::TYPE_SIGNATURES);\n// or \n$signaturesCount = $client-\u003egetCount(Dss\\Client::TYPE_SIGNATURES);\n```\n\nTo create a digital signature you need to create a signing certificate first which can be done with the `getIdentity()`\nmethod. The argument to this method can be an associative array as defined \n[here](https://downloads.globalsign.com/acton/media/2674/digital-signing-service-api-documentation#identity_post). \nThe method will return an `Identity` instance which is nothing more than a data wrapper of the returned id, signing\ncertificate and OCSP response.\n\n```php\n$identity = $client-\u003egetIdentity();\n```\n\nThis `Identity` needs to be forward to the signature module which internally passes it back to the `Dss\\Client\\sign()`\nmethod to get the final signature. It is also possible to use this method individually (just for completion):\n\n```php\n$signature = $client-\u003esign($identity, hash('sha256', $data));\n```\n\n### The `SignatureModule` class\n\nThis is the main signature module which can be used with the [SetaPDF-Signer](https://www.setasign.com/signer) component.\nIts constructor requires these arguments:\n\n- `$signer` is the instance of the `\\SetaPDF_Signer` class to which the module is passed afterwards. Internally [`$signer-\u003esetAllowSignatureContentLengthChange(false)`](https://manuals.setasign.com/api-reference/setapdf/c/SetaPDF.Signer#method_setAllowSignatureContentLengthChange) is called to prohibit redundant signature requests.\n- `$client` needs to be the `Dss\\Client` instance.\n- `$identity` a `Dss\\Identity` instance.\n- `$module` needs to be a [CMS](https://manuals.setasign.com/api-reference/setapdf/c/SetaPDF.Signer.Signature.Module.Cms) or [PAdES](https://manuals.setasign.com/api-reference/setapdf/c/SetaPDF.Signer.Signature.Module.Pades) signature module instance. It is used internally to create the CMS container.\n\nA simple complete signature process would look like this:\n\n```php\n// set up the client and identity\n$options = [\n    'http_errors' =\u003e false,\n    'cert' =\u003e 'path/to/tls-cert.pem',\n    'ssl_key' =\u003e 'path/to/private/key.pem'  \n];\n\n$apiKey = 'xxxxxxxxxxxxxxxx';\n$apiSecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';\n\n$httpClient = new GuzzleHttp\\Client($options);\n// if you are using php 7.0 or 7.1\n//$httpClient = new Mjelamanov\\GuzzlePsr18\\Client($httpClient);\n$requestFactory = new Http\\Factory\\Guzzle\\RequestFactory();\n$streamFactory = new Http\\Factory\\Guzzle\\StreamFactory();\n\n$client = new Dss\\Client($httpClient, $requestFactory, $streamFactory, $apiKey, $apiSecret);\n$identity = $client-\u003egetIdentity();\n\n// now start the signature process\n$writer = new \\SetaPDF_Core_Writer_File('signed.pdf');\n$document = \\SetaPDF_Core_Document::loadByFilename('invoice.pdf', $writer);\n \n$signer = new \\SetaPDF_Signer($document);\n$signer-\u003esetSignatureContentLength(15000);\n\n$pades = new \\SetaPDF_Signer_Signature_Module_Pades();\n$module = new Dss\\SignatureModule($signer, $client, $identity, $pades);\n \n$signer-\u003esign($module);\n```\n\n### The `TimestampModule` class\n\nThis module can be used to add timestamps to the digital signature or to create document level timestamps. It's constructor simply requires a `Dss\\Client` instance:\n\n```php\n$tsmodule = new Dss\\TimestampModule($client);\n```\n\nIt doesn't requires an identity as the signature module but can be passed as it is to the `\\SetaPDF_Signer` instance:\n\n```php\n$signer-\u003esetTimestampModule($tsmodule);\n// ...\n$signer-\u003esign($module);\n```\n\nor you can create a document level timestamp with it:\n\n```php\n$signer-\u003esetTimestampModule($tsmodule);\n// ...\n$signer-\u003etimestamp();\n``` \n\n## Information about Tests\n\nThe test suite currently only comes with functional tests, which invoke **real service calls**! Keep in mind that these\ncalls are deducted from your signature contingent. You should not execute these tests in an automated environment!!\n\nTo execute the tests, you need to create a folder in the root of this package with the following file:\n\n```\n/private/\n    credentials.php\n``` \n\nThe `credentials.php` file needs to return your credentials, certificate and private key:\n```php\n\u003c?php\n        \nreturn [\n    'apiKey' =\u003e '\u003cYOUR API KEY\u003e',\n    'apiSecret' =\u003e '\u003cYOUR API SECRET\u003e',\n    'cert' =\u003e '/path/to/your/mTLS/certificate.pem',\n    'privateKey' =\u003e '/path/to/your/private/key.pem'\n];\n```\n\n## License\n\nThis package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetasign%2Fsetapdf-signer-addon-globalsign-dss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsetasign%2Fsetapdf-signer-addon-globalsign-dss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetasign%2Fsetapdf-signer-addon-globalsign-dss/lists"}