Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.18 KB | None | 0 0
  1. <?php
  2. include('File/ASN1.php');
  3.  
  4. $IdentityObjectMap = array('type' =>FILE_ASN1_TYPE_SEQUENCE,
  5.         'children'=> array(
  6.             'identityIdentificationData' => array('type'=>FILE_ASN1_TYPE_SEQUENCE,
  7.                 'children'=> array(
  8.                     'version' => array('type' => FILE_ASN1_TYPE_IA5_STRING),
  9.                     'staticData' =>array('type' => FILE_ASN1_TYPE_SEQUENCE,
  10.                         'children'=> array(
  11.                             'acceptedPolicyVersion' => array('type' =>FILE_ASN1_TYPE_IA5_STRING),
  12.                             'cardHolderID' => array('type' =>FILE_ASN1_TYPE_INTEGER),
  13.                             'deviceSerialNumber' => array('type' => FILE_ASN1_TYPE_SEQUENCE,
  14.                                 'children'=> array(
  15.                                     'deviceType' => array('type' =>FILE_ASN1_TYPE_INTEGER),
  16.                                     'deviceUniqueID' => array('type' =>FILE_ASN1_TYPE_OCTET_STRING)
  17.                                 ),
  18.                             ),
  19.                             'appLabel' => array('type' =>FILE_ASN1_TYPE_UTF8_STRING),
  20.                             'requestorRole' => array('type' => FILE_ASN1_TYPE_ENUMERATED,
  21.                                 'mapping' => array(
  22.                                     'roleClient',
  23.                                     'roleParticipant'
  24.                                 )
  25.                             ),
  26.                             'creationTime' => array('type' =>FILE_ASN1_TYPE_UTC_TIME)
  27.                         )
  28.                     )
  29.                 )
  30.             )
  31.         )
  32.     );
  33.  
  34. $json = "{
  35. \"identityIdentificationData\":{
  36.      \"version\":\"2.0\",
  37.      \"staticData\":{
  38.         \"acceptedPolicyVersion\":\"2\",
  39.         \"cardHolderID\":11111111111,
  40.         \"deviceSerialNumber\":{
  41.            \"deviceType\":3,
  42.            \"deviceUniqueID\":\"11111111\"
  43.          },
  44.         \"appLabel\":\"examination\",
  45.         \"requestorRole\": \"roleClient\",
  46.         \"creationTime\": \"January 1, 2018\"
  47.       }
  48.    }
  49. }";
  50.  
  51. $IdentityObject = json_decode($json, true);
  52.  
  53. $asn1 = new File_ASN1();
  54. echo $asn1->encodeDER($IdentityObject, $IdentityObjectMap);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement