2017 © Pedro Peláez
 

library asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

image

sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  • Friday, June 15, 2018
  • by sop
  • Repository
  • 2 Watchers
  • 19 Stars
  • 4,873 Installations
  • PHP
  • 7 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 22 Versions
  • 10 % Grown

The README.md

ASN.1

Build Status Scrutinizer Code Quality Coverage Status License, (*1)

A PHP library for X.690 Abstract Syntax Notation One (ASN.1) Distinguished Encoding Rules (DER) encoding and decoding., (*2)

Requirements

  • PHP >=7.2
  • gmp
  • mbstring

Installation

This library is available on Packagist., (*3)

composer require sop/asn1

Usage

The general idea is that each ASN.1 type has its corresponding PHP class, that knows the details of encoding and decoding the specific type., (*4)

To decode DER data, use fromDER static method of the expected type. To encode object to DER, use toDER instance method., (*5)

Many methods return an UnspecifiedType object, that works as an intermediate wrapper with accessor methods ensuring type safety., (*6)

All objects are immutable and method chaining is promoted for the fluency of the API. Exception shall be thrown on errors., (*7)

Code Examples

Here are some simple usage examples. Namespaces are omitted for brevity., (*8)

Encode

Encode a sequence containing a UTF-8 string, an integer and an explicitly tagged object identifier, conforming to the following ASN.1 specification:, (*9)

```asn.1 Example ::= SEQUENCE { greeting UTF8String, answer INTEGER, type [1] EXPLICIT OBJECT IDENTIFIER }, (*10)


```php $seq = new Sequence( new UTF8String('Hello'), new Integer(42), new ExplicitlyTaggedType( 1, new ObjectIdentifier('1.3.6.1.3')) ); $der = $seq->toDER();

Decode

Decode DER encoding from above., (*11)

$seq = UnspecifiedType::fromDER($der)->asSequence();
$greeting = $seq->at(0)->asUTF8String()->string();
$answer = $seq->at(1)->asInteger()->intNumber();
$type = $seq->at(2)->asTagged()->asExplicit()->asObjectIdentifier()->oid();

Real-World Examples

See the following for more practical real-world usage examples., (*12)

ASN.1 References

License

This project is licensed under the MIT License., (*13)

The Versions

15/06 2018

dev-master

9999999-dev https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • ext-gmp *
  • ext-mbstring *
  • php >=7.0

 

The Development Requires

by Joni Eskelinen

asn1 asn.1 der x690 x.690

20/12 2017

3.3.0

3.3.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *
  • ext-mbstring *

 

The Development Requires

by Joni Eskelinen

asn1 asn.1 der x690 x.690

08/11 2017

3.2.0

3.2.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *
  • ext-mbstring *

 

The Development Requires

by Joni Eskelinen

asn1 asn.1 der x690 x.690

07/11 2017

3.1.0

3.1.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *
  • ext-mbstring *

 

The Development Requires

by Joni Eskelinen

asn1 asn.1 der x690 x.690

03/11 2017

3.0.1

3.0.1.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *
  • ext-mbstring *

 

The Development Requires

by Joni Eskelinen

asn1 asn.1 der x690 x.690

03/11 2017

3.0.0

3.0.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *
  • ext-mbstring *

 

The Development Requires

by Joni Eskelinen

asn1 asn.1 der x690 x.690

03/08 2017

2.0.2

2.0.2.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

22/06 2016

2.0.1

2.0.1.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

07/06 2016

2.0.0

2.0.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

01/06 2016

1.5.3

1.5.3.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

01/06 2016

1.5.2

1.5.2.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

01/06 2016

1.5.1

1.5.1.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

24/05 2016

1.5.0

1.5.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

18/05 2016

1.4.1

1.4.1.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

16/05 2016

1.4.0

1.4.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

16/05 2016

1.3.0

1.3.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

10/05 2016

1.2.0

1.2.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

10/05 2016

1.1.0

1.1.0.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

10/05 2016

1.0.3

1.0.3.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

04/05 2016

1.0.2

1.0.2.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

25/04 2016

1.0.1

1.0.1.0 https://github.com/sop/asn1

A PHP library for X.690 ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der x690 x.690

12/04 2016

1.0.0

1.0.0.0

A PHP library for ASN.1 DER encoding and decoding.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-gmp *
  • ext-mbstring *

 

by Joni Eskelinen

asn1 asn.1 der