1<?php
2
3/**
4 * RSAPrivateKey
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
16namespace phpseclib3\File\ASN1\Maps;
17
18use phpseclib3\File\ASN1;
19
20/**
21 * RSAPrivateKey
22 *
23 * @package ASN1
24 * @author  Jim Wigginton <terrafrost@php.net>
25 * @access  public
26 */
27abstract class RSAPrivateKey
28{
29    // version must be multi if otherPrimeInfos present
30    const MAP = [
31        'type' => ASN1::TYPE_SEQUENCE,
32        'children' => [
33            'version' => [
34                'type' => ASN1::TYPE_INTEGER,
35                'mapping' => ['two-prime', 'multi']
36            ],
37            'modulus' => ['type' => ASN1::TYPE_INTEGER],         // n
38            'publicExponent' => ['type' => ASN1::TYPE_INTEGER],  // e
39            'privateExponent' => ['type' => ASN1::TYPE_INTEGER], // d
40            'prime1' => ['type' => ASN1::TYPE_INTEGER],          // p
41            'prime2' => ['type' => ASN1::TYPE_INTEGER],          // q
42            'exponent1' => ['type' => ASN1::TYPE_INTEGER],       // d mod (p-1)
43            'exponent2' => ['type' => ASN1::TYPE_INTEGER],       // d mod (q-1)
44            'coefficient' => ['type' => ASN1::TYPE_INTEGER],     // (inverse of q) mod p
45            'otherPrimeInfos' => OtherPrimeInfos::MAP + ['optional' => true]
46        ]
47    ];
48}
49