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 13... Line 13...
13
 *
13
 *
14
 * Analogous to ssh-keygen's pkcs8 format (as specified by -m). Although PKCS8
14
 * Analogous to ssh-keygen's pkcs8 format (as specified by -m). Although PKCS8
15
 * is specific to private keys it's basically creating a DER-encoded wrapper
15
 * is specific to private keys it's basically creating a DER-encoded wrapper
16
 * for keys. This just extends that same concept to public keys (much like ssh-keygen)
16
 * for keys. This just extends that same concept to public keys (much like ssh-keygen)
17
 *
17
 *
-
 
18
 * @category  Crypt
-
 
19
 * @package   DSA
18
 * @author    Jim Wigginton <terrafrost@php.net>
20
 * @author    Jim Wigginton <terrafrost@php.net>
19
 * @copyright 2015 Jim Wigginton
21
 * @copyright 2015 Jim Wigginton
20
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
22
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
21
 * @link      http://phpseclib.sourceforge.net
23
 * @link      http://phpseclib.sourceforge.net
22
 */
24
 */
Line 30... Line 32...
30
use phpseclib3\Math\BigInteger;
32
use phpseclib3\Math\BigInteger;
31
 
33
 
32
/**
34
/**
33
 * PKCS#8 Formatted DSA Key Handler
35
 * PKCS#8 Formatted DSA Key Handler
34
 *
36
 *
-
 
37
 * @package DSA
35
 * @author  Jim Wigginton <terrafrost@php.net>
38
 * @author  Jim Wigginton <terrafrost@php.net>
-
 
39
 * @access  public
36
 */
40
 */
37
abstract class PKCS8 extends Progenitor
41
abstract class PKCS8 extends Progenitor
38
{
42
{
39
    /**
43
    /**
40
     * OID Name
44
     * OID Name
41
     *
45
     *
42
     * @var string
46
     * @var string
-
 
47
     * @access private
43
     */
48
     */
44
    const OID_NAME = 'id-dsa';
49
    const OID_NAME = 'id-dsa';
45
 
50
 
46
    /**
51
    /**
47
     * OID Value
52
     * OID Value
48
     *
53
     *
49
     * @var string
54
     * @var string
-
 
55
     * @access private
50
     */
56
     */
51
    const OID_VALUE = '1.2.840.10040.4.1';
57
    const OID_VALUE = '1.2.840.10040.4.1';
52
 
58
 
53
    /**
59
    /**
54
     * Child OIDs loaded
60
     * Child OIDs loaded
55
     *
61
     *
56
     * @var bool
62
     * @var bool
-
 
63
     * @access private
57
     */
64
     */
58
    protected static $childOIDsLoaded = false;
65
    protected static $childOIDsLoaded = false;
59
 
66
 
60
    /**
67
    /**
61
     * Break a public or private key down into its constituent components
68
     * Break a public or private key down into its constituent components
62
     *
69
     *
-
 
70
     * @access public
63
     * @param string $key
71
     * @param string $key
64
     * @param string $password optional
72
     * @param string $password optional
65
     * @return array
73
     * @return array
66
     */
74
     */
67
    public static function load($key, $password = '')
75
    public static function load($key, $password = '')
Line 111... Line 119...
111
    }
119
    }
112
 
120
 
113
    /**
121
    /**
114
     * Convert a private key to the appropriate format.
122
     * Convert a private key to the appropriate format.
115
     *
123
     *
-
 
124
     * @access public
116
     * @param \phpseclib3\Math\BigInteger $p
125
     * @param \phpseclib3\Math\BigInteger $p
117
     * @param \phpseclib3\Math\BigInteger $q
126
     * @param \phpseclib3\Math\BigInteger $q
118
     * @param \phpseclib3\Math\BigInteger $g
127
     * @param \phpseclib3\Math\BigInteger $g
119
     * @param \phpseclib3\Math\BigInteger $y
128
     * @param \phpseclib3\Math\BigInteger $y
120
     * @param \phpseclib3\Math\BigInteger $x
129
     * @param \phpseclib3\Math\BigInteger $x
Line 136... Line 145...
136
    }
145
    }
137
 
146
 
138
    /**
147
    /**
139
     * Convert a public key to the appropriate format
148
     * Convert a public key to the appropriate format
140
     *
149
     *
-
 
150
     * @access public
141
     * @param \phpseclib3\Math\BigInteger $p
151
     * @param \phpseclib3\Math\BigInteger $p
142
     * @param \phpseclib3\Math\BigInteger $q
152
     * @param \phpseclib3\Math\BigInteger $q
143
     * @param \phpseclib3\Math\BigInteger $g
153
     * @param \phpseclib3\Math\BigInteger $g
144
     * @param \phpseclib3\Math\BigInteger $y
154
     * @param \phpseclib3\Math\BigInteger $y
145
     * @param array $options optional
155
     * @param array $options optional