Subversion Repositories oidplus

Rev

Rev 846 | 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
 * -----BEGIN PRIVATE KEY-----
13
 * -----BEGIN PRIVATE KEY-----
14
 * -----BEGIN PUBLIC KEY-----
14
 * -----BEGIN PUBLIC KEY-----
15
 *
15
 *
16
 * Analogous to "openssl genpkey -algorithm rsa-pss".
16
 * Analogous to "openssl genpkey -algorithm rsa-pss".
17
 *
17
 *
-
 
18
 * @category  Crypt
-
 
19
 * @package   RSA
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 RSA-PSS Key Handler
35
 * PKCS#8 Formatted RSA-PSS Key Handler
34
 *
36
 *
-
 
37
 * @package RSA
35
 * @author  Jim Wigginton <terrafrost@php.net>
38
 * @author  Jim Wigginton <terrafrost@php.net>
-
 
39
 * @access  public
36
 */
40
 */
37
abstract class PSS extends Progenitor
41
abstract class PSS 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-RSASSA-PSS';
49
    const OID_NAME = 'id-RSASSA-PSS';
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.113549.1.1.10';
57
    const OID_VALUE = '1.2.840.113549.1.1.10';
52
 
58
 
53
    /**
59
    /**
54
     * OIDs loaded
60
     * OIDs loaded
55
     *
61
     *
56
     * @var bool
62
     * @var bool
-
 
63
     * @access private
57
     */
64
     */
58
    private static $oidsLoaded = false;
65
    private static $oidsLoaded = false;
59
 
66
 
60
    /**
67
    /**
61
     * Child OIDs loaded
68
     * Child OIDs loaded
62
     *
69
     *
63
     * @var bool
70
     * @var bool
-
 
71
     * @access private
64
     */
72
     */
65
    protected static $childOIDsLoaded = false;
73
    protected static $childOIDsLoaded = false;
66
 
74
 
67
    /**
75
    /**
68
     * Initialize static variables
76
     * Initialize static variables
Line 89... Line 97...
89
    }
97
    }
90
 
98
 
91
    /**
99
    /**
92
     * Break a public or private key down into its constituent components
100
     * Break a public or private key down into its constituent components
93
     *
101
     *
-
 
102
     * @access public
94
     * @param string $key
103
     * @param string $key
95
     * @param string $password optional
104
     * @param string $password optional
96
     * @return array
105
     * @return array
97
     */
106
     */
98
    public static function load($key, $password = '')
107
    public static function load($key, $password = '')
Line 152... Line 161...
152
    }
161
    }
153
 
162
 
154
    /**
163
    /**
155
     * Convert a private key to the appropriate format.
164
     * Convert a private key to the appropriate format.
156
     *
165
     *
-
 
166
     * @access public
157
     * @param \phpseclib3\Math\BigInteger $n
167
     * @param \phpseclib3\Math\BigInteger $n
158
     * @param \phpseclib3\Math\BigInteger $e
168
     * @param \phpseclib3\Math\BigInteger $e
159
     * @param \phpseclib3\Math\BigInteger $d
169
     * @param \phpseclib3\Math\BigInteger $d
160
     * @param array $primes
170
     * @param array $primes
161
     * @param array $exponents
171
     * @param array $exponents
Line 175... Line 185...
175
    }
185
    }
176
 
186
 
177
    /**
187
    /**
178
     * Convert a public key to the appropriate format
188
     * Convert a public key to the appropriate format
179
     *
189
     *
-
 
190
     * @access public
180
     * @param \phpseclib3\Math\BigInteger $n
191
     * @param \phpseclib3\Math\BigInteger $n
181
     * @param \phpseclib3\Math\BigInteger $e
192
     * @param \phpseclib3\Math\BigInteger $e
182
     * @param array $options optional
193
     * @param array $options optional
183
     * @return string
194
     * @return string
184
     */
195
     */
Line 193... Line 204...
193
    }
204
    }
194
 
205
 
195
    /**
206
    /**
196
     * Encodes PSS parameters
207
     * Encodes PSS parameters
197
     *
208
     *
-
 
209
     * @access public
198
     * @param array $options
210
     * @param array $options
199
     * @return string
211
     * @return string
200
     */
212
     */
201
    public static function savePSSParams(array $options)
213
    public static function savePSSParams(array $options)
202
    {
214
    {