stayallive / tlsa
在PHP中生成TLSA记录。
v2.0.0
2022-01-24 11:34 UTC
Requires
- php: ^8.0
- ext-openssl: *
- spatie/url: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: 3.4.*
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-05 15:27:03 UTC
README
此包包含一个可以生成TLSA资源记录的类。
$tlsa = new Stayallive\TLSA\Builder('alexbouma.me'); $tlsa->forCertificate($pemEncodedCertificate); $tlsa->getRecord(); // returns the full DNS record $tlsa->getRecordContents(); // returns the DNS record contents only
安装
您可以通过composer安装此包。
composer require stayallive/tlsa
用法
该类可以为所有证书使用、选择器和匹配类型生成TLSA资源记录。
更多信息请参阅维基百科条目:https://en.wikipedia.org/wiki/DNS-based_Authentication_of_Named_Entities#RR_data_fields
use Stayallive\TLSA; $tlsa = new TLSA\Builder('alexbouma.me', 25, 'udp'); // Builder for the alexbouma.me domain, port 25 and the UDP protocol $tlsa->forCertificate($pemEncodedCertificate); $tlsa->forPublicKey($pemEncodedPublicKey); $tlsa->certificateUsage(TLSA\Builder::CERTIFICATE_USAGE_DOMAIN_ISSUED_CERTIFICATE); // Set the certificate usage to `3` (default) $tlsa->selector(TLSA\Builder::SELECTOR_PUBLIC_KEY); // Set the selector to `1` (default) $tlsa->matchingType(TLSA\Builder::MATCHING_TYPE_SHA256); // Set the matching type to `1` (default) $dns->getRecord(); // returns the full DNS record $dns->getRecordContents(); // returns the DNS record contents
测试
composer test
变更日志
请参阅CHANGELOG以获取最近更改的更多信息。
贡献
请参阅CONTRIBUTING以获取详细信息。
安全
如果您发现任何与安全相关的问题,请通过me@alexbouma.me发送电子邮件,而不是使用问题跟踪器。
致谢
许可
MIT许可(MIT)。有关更多信息,请参阅许可文件。