Subversion Repositories oidplus

Rev

Rev 846 | Rev 1042 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 846 Rev 874
Line 15... Line 15...
15
 *
15
 *
16
 * Analogous to ssh-keygen's pkcs8 format (as specified by -m). Although PKCS8
16
 * Analogous to ssh-keygen's pkcs8 format (as specified by -m). Although PKCS8
17
 * is specific to private keys it's basically creating a DER-encoded wrapper
17
 * is specific to private keys it's basically creating a DER-encoded wrapper
18
 * for keys. This just extends that same concept to public keys (much like ssh-keygen)
18
 * for keys. This just extends that same concept to public keys (much like ssh-keygen)
19
 *
19
 *
-
 
20
 * @category  Crypt
-
 
21
 * @package   RSA
20
 * @author    Jim Wigginton <terrafrost@php.net>
22
 * @author    Jim Wigginton <terrafrost@php.net>
21
 * @copyright 2015 Jim Wigginton
23
 * @copyright 2015 Jim Wigginton
22
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
24
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
23
 * @link      http://phpseclib.sourceforge.net
25
 * @link      http://phpseclib.sourceforge.net
24
 */
26
 */
Line 31... Line 33...
31
use phpseclib3\Math\BigInteger;
33
use phpseclib3\Math\BigInteger;
32
 
34
 
33
/**
35
/**
34
 * PKCS#8 Formatted RSA Key Handler
36
 * PKCS#8 Formatted RSA Key Handler
35
 *
37
 *
-
 
38
 * @package RSA
36
 * @author  Jim Wigginton <terrafrost@php.net>
39
 * @author  Jim Wigginton <terrafrost@php.net>
-
 
40
 * @access  public
37
 */
41
 */
38
abstract class PKCS8 extends Progenitor
42
abstract class PKCS8 extends Progenitor
39
{
43
{
40
    /**
44
    /**
41
     * OID Name
45
     * OID Name
42
     *
46
     *
43
     * @var string
47
     * @var string
-
 
48
     * @access private
44
     */
49
     */
45
    const OID_NAME = 'rsaEncryption';
50
    const OID_NAME = 'rsaEncryption';
46
 
51
 
47
    /**
52
    /**
48
     * OID Value
53
     * OID Value
49
     *
54
     *
50
     * @var string
55
     * @var string
-
 
56
     * @access private
51
     */
57
     */
52
    const OID_VALUE = '1.2.840.113549.1.1.1';
58
    const OID_VALUE = '1.2.840.113549.1.1.1';
53
 
59
 
54
    /**
60
    /**
55
     * Child OIDs loaded
61
     * Child OIDs loaded
56
     *
62
     *
57
     * @var bool
63
     * @var bool
-
 
64
     * @access private
58
     */
65
     */
59
    protected static $childOIDsLoaded = false;
66
    protected static $childOIDsLoaded = false;
60
 
67
 
61
    /**
68
    /**
62
     * Break a public or private key down into its constituent components
69
     * Break a public or private key down into its constituent components
63
     *
70
     *
-
 
71
     * @access public
64
     * @param string $key
72
     * @param string $key
65
     * @param string $password optional
73
     * @param string $password optional
66
     * @return array
74
     * @return array
67
     */
75
     */
68
    public static function load($key, $password = '')
76
    public static function load($key, $password = '')
Line 103... Line 111...
103
    }
111
    }
104
 
112
 
105
    /**
113
    /**
106
     * Convert a private key to the appropriate format.
114
     * Convert a private key to the appropriate format.
107
     *
115
     *
-
 
116
     * @access public
108
     * @param \phpseclib3\Math\BigInteger $n
117
     * @param \phpseclib3\Math\BigInteger $n
109
     * @param \phpseclib3\Math\BigInteger $e
118
     * @param \phpseclib3\Math\BigInteger $e
110
     * @param \phpseclib3\Math\BigInteger $d
119
     * @param \phpseclib3\Math\BigInteger $d
111
     * @param array $primes
120
     * @param array $primes
112
     * @param array $exponents
121
     * @param array $exponents
Line 123... Line 132...
123
    }
132
    }
124
 
133
 
125
    /**
134
    /**
126
     * Convert a public key to the appropriate format
135
     * Convert a public key to the appropriate format
127
     *
136
     *
-
 
137
     * @access public
128
     * @param \phpseclib3\Math\BigInteger $n
138
     * @param \phpseclib3\Math\BigInteger $n
129
     * @param \phpseclib3\Math\BigInteger $e
139
     * @param \phpseclib3\Math\BigInteger $e
130
     * @param array $options optional
140
     * @param array $options optional
131
     * @return string
141
     * @return string
132
     */
142
     */