https://github.com/paragonie/hpkp-builder
Build HTTP Public-Key-Pinning headers from a JSON file (or build them programmatically)
https://github.com/paragonie/hpkp-builder
Last synced: 10 months ago
JSON representation
Build HTTP Public-Key-Pinning headers from a JSON file (or build them programmatically)
- Host: GitHub
- URL: https://github.com/paragonie/hpkp-builder
- Owner: paragonie
- License: other
- Created: 2016-06-19T14:54:24.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-09-03T22:38:55.000Z (over 8 years ago)
- Last Synced: 2024-08-09T10:12:35.773Z (almost 2 years ago)
- Language: PHP
- Homepage: https://paragonie.com/projects
- Size: 19.5 KB
- Stars: 41
- Watchers: 8
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTTP Public-Key-Pinning Builder
[](https://travis-ci.org/paragonie/hpkp-builder)
This library aims to make it easy to build HTTP Public-Key-Pinning headers
in your PHP projects. HPKP Builder was was created by
[Paragon Initiative Enterprises](https://paragonie.com) as part of our effort
to encourage better [application security](https://paragonie.com/service/appsec)
practices.
Check out our other [open source projects](https://paragonie.com/projects) too.
## PHP Version requirements
* PHP 7.0 or newer
## Build a Public-Key-Pinning header from a JSON configuration file
```php
sendHPKPHeader();
```
### Example JSON configuration
```json
{
"hashes": [
{
"algo": "sha256",
"hash": "hwGEkxDWJ2oHtKv6lsvylKvhotXAAZQR1e0nq0eb2Vw="
},
{
"algo": "sha256",
"hash": "0jum0Eiu4Eg6vjn3zTmyd/RobfN6e4EagFQcz6E5ZKI="
}
],
"include-subdomains": false,
"max-age": 5184000,
"report-only": false,
"report-uri": null
}
```
## Build a Public-Key-Pinning Header
```php
addHash('hwGEkxDWJ2oHtKv6lsvylKvhotXAAZQR1e0nq0eb2Vw=')
->addHash('0jum0Eiu4Eg6vjn3zTmyd/RobfN6e4EagFQcz6E5ZKI=')
->addHash('JDR7yv7lvdKaM26fnKriSPiyryeYw9qi5sO8Ot7SNUQ=')
->includeSubdomains(true)
->reportOnly(true)
->reportUri('https://report-uri.io')
->sendHPKPHeader();
```