Subversion Repositories oidplus

Rev

Rev 874 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /**
  4.  * TBSCertificate
  5.  *
  6.  * PHP version 5
  7.  *
  8.  * @author    Jim Wigginton <terrafrost@php.net>
  9.  * @copyright 2016 Jim Wigginton
  10.  * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
  11.  * @link      http://phpseclib.sourceforge.net
  12.  */
  13.  
  14. namespace phpseclib3\File\ASN1\Maps;
  15.  
  16. use phpseclib3\File\ASN1;
  17.  
  18. /**
  19.  * TBSCertificate
  20.  *
  21.  * @author  Jim Wigginton <terrafrost@php.net>
  22.  */
  23. abstract class TBSCertificate
  24. {
  25.     // assert($TBSCertificate['children']['signature'] == $Certificate['children']['signatureAlgorithm'])
  26.     const MAP = [
  27.         'type' => ASN1::TYPE_SEQUENCE,
  28.         'children' => [
  29.             // technically, default implies optional, but we'll define it as being optional, none-the-less, just to
  30.             // reenforce that fact
  31.             'version' => [
  32.                 'type' => ASN1::TYPE_INTEGER,
  33.                 'constant' => 0,
  34.                 'optional' => true,
  35.                 'explicit' => true,
  36.                 'mapping' => ['v1', 'v2', 'v3'],
  37.                 'default' => 'v1'
  38.             ],
  39.             'serialNumber' => CertificateSerialNumber::MAP,
  40.             'signature' => AlgorithmIdentifier::MAP,
  41.             'issuer' => Name::MAP,
  42.             'validity' => Validity::MAP,
  43.             'subject' => Name::MAP,
  44.             'subjectPublicKeyInfo' => SubjectPublicKeyInfo::MAP,
  45.             // implicit means that the T in the TLV structure is to be rewritten, regardless of the type
  46.             'issuerUniqueID' => [
  47.                 'constant' => 1,
  48.                 'optional' => true,
  49.                 'implicit' => true
  50.             ] + UniqueIdentifier::MAP,
  51.             'subjectUniqueID' => [
  52.                 'constant' => 2,
  53.                 'optional' => true,
  54.                 'implicit' => true
  55.             ] + UniqueIdentifier::MAP,
  56.             // <http://tools.ietf.org/html/rfc2459#page-74> doesn't use the EXPLICIT keyword but if
  57.             // it's not IMPLICIT, it's EXPLICIT
  58.             'extensions' => [
  59.                 'constant' => 3,
  60.                 'optional' => true,
  61.                 'explicit' => true
  62.             ] + Extensions::MAP
  63.         ]
  64.     ];
  65. }
  66.