1. Go to this page and download the library: Download adapik/phpasn1 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
adapik / phpasn1 example snippets
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);
use FG\ASN1\Object;
$base64String = ...
$binaryData = base64_decode($base64String);
$asnObject = Object::fromBinary($binaryData);
// do stuff
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.