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 3... Line 3...
3
/**
3
/**
4
 * PuTTY Formatted RSA Key Handler
4
 * PuTTY Formatted RSA Key Handler
5
 *
5
 *
6
 * PHP version 5
6
 * PHP version 5
7
 *
7
 *
-
 
8
 * @category  Crypt
-
 
9
 * @package   RSA
8
 * @author    Jim Wigginton <terrafrost@php.net>
10
 * @author    Jim Wigginton <terrafrost@php.net>
9
 * @copyright 2015 Jim Wigginton
11
 * @copyright 2015 Jim Wigginton
10
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
12
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
11
 * @link      http://phpseclib.sourceforge.net
13
 * @link      http://phpseclib.sourceforge.net
12
 */
14
 */
Line 18... Line 20...
18
use phpseclib3\Math\BigInteger;
20
use phpseclib3\Math\BigInteger;
19
 
21
 
20
/**
22
/**
21
 * PuTTY Formatted RSA Key Handler
23
 * PuTTY Formatted RSA Key Handler
22
 *
24
 *
-
 
25
 * @package RSA
23
 * @author  Jim Wigginton <terrafrost@php.net>
26
 * @author  Jim Wigginton <terrafrost@php.net>
-
 
27
 * @access  public
24
 */
28
 */
25
abstract class PuTTY extends Progenitor
29
abstract class PuTTY extends Progenitor
26
{
30
{
27
    /**
31
    /**
28
     * Public Handler
32
     * Public Handler
29
     *
33
     *
30
     * @var string
34
     * @var string
-
 
35
     * @access private
31
     */
36
     */
32
    const PUBLIC_HANDLER = 'phpseclib3\Crypt\RSA\Formats\Keys\OpenSSH';
37
    const PUBLIC_HANDLER = 'phpseclib3\Crypt\RSA\Formats\Keys\OpenSSH';
33
 
38
 
34
    /**
39
    /**
35
     * Algorithm Identifier
40
     * Algorithm Identifier
36
     *
41
     *
37
     * @var array
42
     * @var array
-
 
43
     * @access private
38
     */
44
     */
39
    protected static $types = ['ssh-rsa'];
45
    protected static $types = ['ssh-rsa'];
40
 
46
 
41
    /**
47
    /**
42
     * Break a public or private key down into its constituent components
48
     * Break a public or private key down into its constituent components
43
     *
49
     *
-
 
50
     * @access public
44
     * @param string $key
51
     * @param string $key
45
     * @param string $password optional
52
     * @param string $password optional
46
     * @return array
53
     * @return array
47
     */
54
     */
48
    public static function load($key, $password = '')
55
    public static function load($key, $password = '')
Line 83... Line 90...
83
    }
90
    }
84
 
91
 
85
    /**
92
    /**
86
     * Convert a private key to the appropriate format.
93
     * Convert a private key to the appropriate format.
87
     *
94
     *
-
 
95
     * @access public
88
     * @param \phpseclib3\Math\BigInteger $n
96
     * @param \phpseclib3\Math\BigInteger $n
89
     * @param \phpseclib3\Math\BigInteger $e
97
     * @param \phpseclib3\Math\BigInteger $e
90
     * @param \phpseclib3\Math\BigInteger $d
98
     * @param \phpseclib3\Math\BigInteger $d
91
     * @param array $primes
99
     * @param array $primes
92
     * @param array $exponents
100
     * @param array $exponents
Line 108... Line 116...
108
    }
116
    }
109
 
117
 
110
    /**
118
    /**
111
     * Convert a public key to the appropriate format
119
     * Convert a public key to the appropriate format
112
     *
120
     *
-
 
121
     * @access public
113
     * @param \phpseclib3\Math\BigInteger $n
122
     * @param \phpseclib3\Math\BigInteger $n
114
     * @param \phpseclib3\Math\BigInteger $e
123
     * @param \phpseclib3\Math\BigInteger $e
115
     * @return string
124
     * @return string
116
     */
125
     */
117
    public static function savePublicKey(BigInteger $n, BigInteger $e)
126
    public static function savePublicKey(BigInteger $n, BigInteger $e)