vakata / asn1
An ASN1 encoder / decoder
Installs: 15 790
Dependents: 3
Suggesters: 0
Security: 0
Stars: 15
Watchers: 2
Forks: 3
Open Issues: 0
Requires
- php: >=8.0.0
Requires (Dev)
- phpunit/phpunit: 6.*
- victorjonsson/markdowndocs: ^1.3
README
Am ASN1 encoder / decoder.
Install
Via Composer
$ composer require vakata/asn1
Usage
The main part of the library are the Decoder
and Encoder
classes.
// 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);
There are helper classes in the structures
namespace - these help with working with common known structures. All the structures have fromString
and fromFile
static constructor methods, and a toArray
method.
// 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
Read more in the API docs
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email github@vakata.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.