RSAPrivateKey.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * RSAPrivateKey
  4. *
  5. * PHP version 5
  6. *
  7. * @category File
  8. * @package ASN1
  9. * @author Jim Wigginton <terrafrost@php.net>
  10. * @copyright 2016 Jim Wigginton
  11. * @license http://www.opensource.org/licenses/mit-license.html MIT License
  12. * @link http://phpseclib.sourceforge.net
  13. */
  14. namespace phpseclib\File\ASN1\Maps;
  15. use phpseclib\File\ASN1;
  16. /**
  17. * RSAPrivateKey
  18. *
  19. * @package ASN1
  20. * @author Jim Wigginton <terrafrost@php.net>
  21. * @access public
  22. */
  23. abstract class RSAPrivateKey
  24. {
  25. // version must be multi if otherPrimeInfos present
  26. const MAP = [
  27. 'type' => ASN1::TYPE_SEQUENCE,
  28. 'children' => [
  29. 'version' => [
  30. 'type' => ASN1::TYPE_INTEGER,
  31. 'mapping' => ['two-prime', 'multi']
  32. ],
  33. 'modulus' => ['type' => ASN1::TYPE_INTEGER], // n
  34. 'publicExponent' => ['type' => ASN1::TYPE_INTEGER], // e
  35. 'privateExponent' => ['type' => ASN1::TYPE_INTEGER], // d
  36. 'prime1' => ['type' => ASN1::TYPE_INTEGER], // p
  37. 'prime2' => ['type' => ASN1::TYPE_INTEGER], // q
  38. 'exponent1' => ['type' => ASN1::TYPE_INTEGER], // d mod (p-1)
  39. 'exponent2' => ['type' => ASN1::TYPE_INTEGER], // d mod (q-1)
  40. 'coefficient' => ['type' => ASN1::TYPE_INTEGER], // (inverse of q) mod p
  41. 'otherPrimeInfos' => OtherPrimeInfos::MAP + ['optional' => true]
  42. ]
  43. ];
  44. }