{"id":20790389,"url":"https://github.com/paragonie/hpkp-builder","last_synced_at":"2025-07-18T08:02:25.076Z","repository":{"id":57035823,"uuid":"61485264","full_name":"paragonie/hpkp-builder","owner":"paragonie","description":"Build HTTP Public-Key-Pinning headers from a JSON file (or build them programmatically)","archived":false,"fork":false,"pushed_at":"2017-09-03T22:38:55.000Z","size":20,"stargazers_count":41,"open_issues_count":2,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-09T10:12:35.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://paragonie.com/projects","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paragonie.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}},"created_at":"2016-06-19T14:54:24.000Z","updated_at":"2023-09-06T11:24:56.000Z","dependencies_parsed_at":"2022-08-23T22:10:17.155Z","dependency_job_id":null,"html_url":"https://github.com/paragonie/hpkp-builder","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fhpkp-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fhpkp-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fhpkp-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Fhpkp-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paragonie","download_url":"https://codeload.github.com/paragonie/hpkp-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225057702,"owners_count":17414381,"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":[],"created_at":"2024-11-17T15:34:36.703Z","updated_at":"2024-11-17T15:34:37.335Z","avatar_url":"https://github.com/paragonie.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTP Public-Key-Pinning Builder\n\n[![Build Status](https://travis-ci.org/paragonie/hpkp-builder.svg?branch=master)](https://travis-ci.org/paragonie/hpkp-builder)\n\nThis library aims to make it easy to build HTTP Public-Key-Pinning headers\nin your PHP projects. HPKP Builder was  was created by\n[Paragon Initiative Enterprises](https://paragonie.com) as part of our effort\nto encourage better [application security](https://paragonie.com/service/appsec)\npractices.\n\nCheck out our other [open source projects](https://paragonie.com/projects) too.\n\n## PHP Version requirements\n\n* PHP 7.0 or newer\n\n## Build a Public-Key-Pinning header from a JSON configuration file\n\n```php\n\u003c?php\n\nuse \\ParagonIE\\HPKPBuilder\\HPKPBuilder;\n\n$hpkp = HPKPBuilder::fromFile('/path/to/source.json');\n$hpkp-\u003esendHPKPHeader();\n```\n### Example JSON configuration\n\n```json\n{\n    \"hashes\": [\n        {\n            \"algo\": \"sha256\",\n            \"hash\": \"hwGEkxDWJ2oHtKv6lsvylKvhotXAAZQR1e0nq0eb2Vw=\"\n        },\n        {\n            \"algo\": \"sha256\",\n            \"hash\": \"0jum0Eiu4Eg6vjn3zTmyd/RobfN6e4EagFQcz6E5ZKI=\"\n        }\n    ],\n    \"include-subdomains\": false,\n    \"max-age\": 5184000,\n    \"report-only\": false,\n    \"report-uri\": null\n}\n```\n\n## Build a Public-Key-Pinning Header\n\n```php\n\u003c?php\n\nuse \\ParagonIE\\HPKPBuilder\\HPKPBuilder;\n\n$hpkp = (new HPKPBuilder)\n    -\u003eaddHash('hwGEkxDWJ2oHtKv6lsvylKvhotXAAZQR1e0nq0eb2Vw=')\n    -\u003eaddHash('0jum0Eiu4Eg6vjn3zTmyd/RobfN6e4EagFQcz6E5ZKI=')\n    -\u003eaddHash('JDR7yv7lvdKaM26fnKriSPiyryeYw9qi5sO8Ot7SNUQ=')\n    -\u003eincludeSubdomains(true)\n    -\u003ereportOnly(true)\n    -\u003ereportUri('https://report-uri.io')\n    -\u003esendHPKPHeader();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagonie%2Fhpkp-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparagonie%2Fhpkp-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagonie%2Fhpkp-builder/lists"}