PHPackages                             vakata/asn1 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. vakata/asn1

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vakata/asn1
===========

An ASN1 encoder / decoder

2.3.3(1y ago)1626.8k↓40.2%33MITPHPPHP &gt;=8.0.0CI failing

Since Mar 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/vakata/asn1)[ Packagist](https://packagist.org/packages/vakata/asn1)[ Docs](https://github.com/vakata/asn1)[ RSS](/packages/vakata-asn1/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (38)Used By (3)

asn1
====

[](#asn1)

[![Latest Version on Packagist](https://camo.githubusercontent.com/264462e017f632cf3c3c3529f0db09596b00c0c771c51b60d246701275cbf893/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616b6174612f61736e312e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vakata/asn1)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a2d24effb2cd02c572f6d3643edeabfb721307d4d03ebcf1fc1eb7925b5f11c2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f76616b6174612f61736e312f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/vakata/asn1)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e4148671ccfaa4f5bb12e29f11b0805ee1bf55579c1ee73c8aa85420c198162c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f76616b6174612f61736e312e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/vakata/asn1)[![Code Coverage](https://camo.githubusercontent.com/73fbbdb833c51e23ccfc4cd841d62a8f7ab5c6160f861cba10a1a4b977ed8ec3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f76616b6174612f61736e312e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/vakata/asn1)

Am ASN1 encoder / decoder.

Install
-------

[](#install)

Via Composer

```
$ composer require vakata/asn1
```

Usage
-----

[](#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](api.md)

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [vakata](https://github.com/vakata)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance42

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 97.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Recently: every ~187 days

Total

37

Last Release

472d ago

Major Versions

1.6.0 → 2.0.02018-12-11

PHP version history (3 changes)1.0.0PHP &gt;=5.4.0

2.0.0PHP &gt;=7.0.0

2.3.0PHP &gt;=8.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d28c78c63326e84720007ecc58d0eb8c8d0d4fa4b887f95fb3a583423ca09e18?d=identicon)[vakata](/maintainers/vakata)

---

Top Contributors

[![vakata](https://avatars.githubusercontent.com/u/146052?v=4)](https://github.com/vakata "vakata (76 commits)")[![jelly](https://avatars.githubusercontent.com/u/67428?v=4)](https://github.com/jelly "jelly (1 commits)")[![josemmo](https://avatars.githubusercontent.com/u/4470267?v=4)](https://github.com/josemmo "josemmo (1 commits)")

---

Tags

asn1vakata

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vakata-asn1/health.svg)

```
[![Health](https://phpackages.com/badges/vakata-asn1/health.svg)](https://phpackages.com/packages/vakata-asn1)
```

###  Alternatives

[sop/crypto-types

A PHP library of various ASN.1 types for cryptographic applications.

111.4M33](/packages/sop-crypto-types)[freedsx/asn1

An ASN.1 library for PHP.

15216.5k9](/packages/freedsx-asn1)[nikic/include-interceptor

Intercept PHP includes

6967.4k2](/packages/nikic-include-interceptor)[falseclock/advanced-cms

A PHP Library that allows you to decode and manipulate CAdES or in other words CMS Advanced Electronic Signatures described in ETSI standart TS 101 733.

223.2k](/packages/falseclock-advanced-cms)[daveawb/understated

A PHP Finite State Machine for Laravel 5+

302.0k](/packages/daveawb-understated)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
