PHP code example of hidasw / asn1

1. Go to this page and download the library: Download hidasw/asn1 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/ */

    

hidasw / asn1 example snippets



// $hex is hex form such from bin2hex()
$return = asn1::parse($hex);

$maxdepth = 9;
asn1::parse($hex, $maxdepth);

asn1::sequence($hexdata);

asn1::set($hexdata);

asn1::sequence(
              asn::sequence(
                            asn1::integer('2')
                            ).
              asn1::set(
                        asn1::bitstr('00')
                        )
              );


asn1::sequence($hex);
asn1::octet($hex);
asn1::object($hex);
asn1::bitstr($hex);
asn1::printablestr($str);
asn1::integer($int);
asn1::set($hex);
asn1::explicit($explicitNumber, $hex);
asn1::implicit($num="0");
asn1::utctime($time); // ymdHis
asn1::generalizedtime($time); // YmdHis
asn1::utf8str($str);
asn1::ia5str($str);
asn1::visiblestr($str);
asn1::t61str($str);