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 10... Line 10...
10
 * "Naked" Curve25519 public keys also a string of 32 bytes so distinguishing between a "naked"
10
 * "Naked" Curve25519 public keys also a string of 32 bytes so distinguishing between a "naked"
11
 * curve25519 private key and a public key is nigh impossible, hence separate plugins for each
11
 * curve25519 private key and a public key is nigh impossible, hence separate plugins for each
12
 *
12
 *
13
 * PHP version 5
13
 * PHP version 5
14
 *
14
 *
-
 
15
 * @category  Crypt
-
 
16
 * @package   EC
15
 * @author    Jim Wigginton <terrafrost@php.net>
17
 * @author    Jim Wigginton <terrafrost@php.net>
16
 * @copyright 2015 Jim Wigginton
18
 * @copyright 2015 Jim Wigginton
17
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
19
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
18
 * @link      http://phpseclib.sourceforge.net
20
 * @link      http://phpseclib.sourceforge.net
19
 */
21
 */
Line 27... Line 29...
27
use phpseclib3\Math\BigInteger;
29
use phpseclib3\Math\BigInteger;
28
 
30
 
29
/**
31
/**
30
 * Montgomery Curve Private Key Handler
32
 * Montgomery Curve Private Key Handler
31
 *
33
 *
-
 
34
 * @package EC
32
 * @author  Jim Wigginton <terrafrost@php.net>
35
 * @author  Jim Wigginton <terrafrost@php.net>
-
 
36
 * @access  public
33
 */
37
 */
34
abstract class MontgomeryPrivate
38
abstract class MontgomeryPrivate
35
{
39
{
36
    /**
40
    /**
37
     * Is invisible flag
41
     * Is invisible flag
38
     *
42
     *
-
 
43
     * @access private
39
     */
44
     */
40
    const IS_INVISIBLE = true;
45
    const IS_INVISIBLE = true;
41
 
46
 
42
    /**
47
    /**
43
     * Break a public or private key down into its constituent components
48
     * Break a public or private key down into its constituent components
44
     *
49
     *
-
 
50
     * @access public
45
     * @param string $key
51
     * @param string $key
46
     * @param string $password optional
52
     * @param string $password optional
47
     * @return array
53
     * @return array
48
     */
54
     */
49
    public static function load($key, $password = '')
55
    public static function load($key, $password = '')
Line 69... Line 75...
69
    }
75
    }
70
 
76
 
71
    /**
77
    /**
72
     * Convert an EC public key to the appropriate format
78
     * Convert an EC public key to the appropriate format
73
     *
79
     *
-
 
80
     * @access public
74
     * @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve
81
     * @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve
75
     * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
82
     * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
76
     * @return string
83
     * @return string
77
     */
84
     */
78
    public static function savePublicKey(MontgomeryCurve $curve, array $publicKey)
85
    public static function savePublicKey(MontgomeryCurve $curve, array $publicKey)
Line 81... Line 88...
81
    }
88
    }
82
 
89
 
83
    /**
90
    /**
84
     * Convert a private key to the appropriate format.
91
     * Convert a private key to the appropriate format.
85
     *
92
     *
-
 
93
     * @access public
86
     * @param \phpseclib3\Math\BigInteger $privateKey
94
     * @param \phpseclib3\Math\BigInteger $privateKey
87
     * @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve
95
     * @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve
88
     * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
96
     * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey
89
     * @param string $password optional
97
     * @param string $password optional
90
     * @return string
98
     * @return string