Subversion Repositories oidplus

Rev

Rev 846 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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