vakata / asn1
ASN1 编码器/解码器
2.3.2
2023-01-18 09:52 UTC
Requires
- php: >=8.0.0
Requires (Dev)
- phpunit/phpunit: 6.*
- victorjonsson/markdowndocs: ^1.3
README
这是一个 ASN1 编码器/解码器。
安装
通过 Composer
$ composer require vakata/asn1
用法
库的主要部分是 Decoder
和 Encoder
类。
// first create an instance (there is a fromFile static method as well) $decoded = \vakata\asn1\Decoder::fromString("...ASN1 data here ..."); // you can then inspect the parsed raw data $decoded->structure(); // more info $decoded->values(); // just values // or map the data to an existing map $decoded->map($mapArray); // the encoder on the otherhand needs some data and a map \vakata\asn1\Encoder::encode($dataArray, $mapArray);
在 structures
命名空间中存在辅助类 - 这些类有助于处理常见的已知结构。所有结构都有 fromString
和 fromFile
静态构造函数方法,以及一个 toArray
方法。
// Timestamp example: \vakata\asn1\structures\TimestampRequest::fromString($tsq)->toArray(); \vakata\asn1\structures\TimestampResponse::fromFile('/path/to/timestamp/response')->toArray(); \vakata\asn1\structures\TimestampRequest::generateFromFile('/path/to/file/to/timestamp'); // You can also work with Certificate, CRL, OCSPRequest, OCSPResponse, P7S
更多内容请参阅 API 文档
测试
$ composer test
贡献
请参阅 CONTRIBUTING 以获取详细信息。
安全
如果您发现任何与安全相关的问题,请通过电子邮件 github@vakata.com 联系我们,而不是使用问题跟踪器。
致谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。