2017 © Pedro Peláez
 

library phpasn1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

image

adapik/phpasn1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  • Thursday, March 29, 2018
  • by Adapik
  • Repository
  • 1 Watchers
  • 1 Stars
  • 479 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 19 Forks
  • 3 Open issues
  • 22 Versions
  • 1 % Grown

The README.md

PHPASN1

Build Status PHP 7 ready Coverage Status, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules. This encoding is very frequently used in X.509 PKI environments or the communication between heterogeneous computer systems., (*3)

The API allows you to encode ASN.1 structures to create binary data such as certificate signing requests (CSR), X.509 certificates or certificate revocation lists (CRL). PHPASN1 can also read BER encoded binary data into separate PHP objects that can be manipulated by the user and reencoded afterwards., (*4)

The changelog can now be found at CHANGELOG.md., (*5)

Dependencies

PHPASN1 requires at least PHP 7 and the gmp extension., (*6)

Installation

The preferred way to install this library is to rely on Composer:, (*7)

$ composer require Adapik/phpasn1

Usage

Encoding ASN.1 Structures

PHPASN1 offers you a class for each of the implemented ASN.1 universal types. The constructors should be pretty self explanatory so you should have no big trouble getting started. All data will be encoded using DER encoding, (*8)

use FG\ASN1\Universal\Integer;
use FG\ASN1\Universal\Boolean;
use FG\ASN1\Universal\Enumerated;
use FG\ASN1\Universal\IA5String;
use FG\ASN1\Universal\ObjectIdentifier;
use FG\ASN1\Universal\PrintableString;
use FG\ASN1\Universal\Sequence;
use FG\ASN1\Universal\Set;
use FG\ASN1\Universal\NullObject;

$integer = Integer::create(123456);        
$boolean = Boolean::create(true);
$enum = Enumerated::create(1);

$asnNull = NullObject::create();
$objectIdentifier1 = ObjectIdentifier('1.2.250.1.16.9');
$printableString = PrintableString::createFromString('Foo bar');

$sequence = Sequence::create([$integer, $boolean, $enum, $ia5String]);
$set = Set([$sequence, $asnNull, $objectIdentifier1, $objectIdentifier2, $printableString]);

$myBinary  = $sequence->getBinary();
$myBinary .= $set->getBinary();

echo base64_encode($myBinary);

Decoding binary data

Decoding BER encoded binary data is just as easy as encoding it:, (*9)

use FG\ASN1\Object;

$base64String = ...
$binaryData = base64_decode($base64String);        
$asnObject = Object::fromBinary($binaryData);
// do stuff

You can use this function to make sure your data has exactly the format you are expecting., (*10)

Thanks

To all contributors so far!, (*11)

License

This library is distributed under the MIT License., (*12)

The Versions

29/03 2018

dev-add-lazy-get-value

dev-add-lazy-get-value https://github.com/Adapik/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

05/03 2018

dev-master

9999999-dev https://github.com/Adapik/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

05/03 2018

2.0.3

2.0.3.0 https://github.com/Adapik/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

28/07 2017

2.0.2

2.0.2.0 https://github.com/Adapik/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

25/07 2017

2.0.1

2.0.1.0 https://github.com/Adapik/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

16/07 2017

dev-encoder

dev-encoder https://github.com/Adapik/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

13/07 2017

2.0.0

2.0.0.0 https://github.com/Adapik/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

12/07 2017

dev-cleanup

dev-cleanup https://github.com/Adapik/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • ext-gmp *
  • php >=7.0

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

30/10 2015

dev-dev-parser

dev-dev-parser https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

02/10 2015

1.5.1

1.5.1.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-gmp *

 

The Development Requires

x509 x.509 asn1 asn.1 binary encoding decoding der x690 x.690 ber

30/09 2015

dev-compat/php5-5

dev-compat/php5-5 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-gmp *

 

The Development Requires

30/09 2015

1.5.0

1.5.0.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-gmp *

 

The Development Requires

29/09 2015

1.4.2

1.4.2.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-gmp *

 

The Development Requires

15/09 2015

1.4.1

1.4.1.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-gmp *

 

The Development Requires

17/08 2015

1.4.0

1.4.0.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.6.0
  • ext-gmp *

 

The Development Requires

15/07 2015

1.3.2

1.3.2.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gmp *

 

The Development Requires

28/04 2015

1.3.1

1.3.1.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gmp *

 

The Development Requires

28/04 2015

1.3.0

1.3.0.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gmp *

 

The Development Requires

05/04 2015

1.2.0

1.2.0.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

14/02 2015

1.1.0

1.1.0.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

GPLv3

The Requires

  • php >=5.3.0

 

The Development Requires

03/02 2015

1.0.0

1.0.0.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

GPLv3

The Requires

  • php >=5.3.0

 

The Development Requires

03/02 2015

0.9.0

0.9.0.0 https://github.com/FGrosse/PHPASN1

A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.

  Sources   Download

GPLv3

The Requires

  • php >=5.3.0

 

The Development Requires