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 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/**
3
/**
4
 * DSA Private Key
4
 * DSA Private Key
5
 *
5
 *
-
 
6
 * @category  Crypt
-
 
7
 * @package   DSA
6
 * @author    Jim Wigginton <terrafrost@php.net>
8
 * @author    Jim Wigginton <terrafrost@php.net>
7
 * @copyright 2015 Jim Wigginton
9
 * @copyright 2015 Jim Wigginton
8
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
10
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
9
 * @link      http://phpseclib.sourceforge.net
11
 * @link      http://phpseclib.sourceforge.net
10
 */
12
 */
Line 17... Line 19...
17
use phpseclib3\Math\BigInteger;
19
use phpseclib3\Math\BigInteger;
18
 
20
 
19
/**
21
/**
20
 * DSA Private Key
22
 * DSA Private Key
21
 *
23
 *
-
 
24
 * @package DSA
22
 * @author  Jim Wigginton <terrafrost@php.net>
25
 * @author  Jim Wigginton <terrafrost@php.net>
-
 
26
 * @access  public
23
 */
27
 */
24
class PrivateKey extends DSA implements Common\PrivateKey
28
class PrivateKey extends DSA implements Common\PrivateKey
25
{
29
{
26
    use Common\Traits\PasswordProtected;
30
    use Common\Traits\PasswordProtected;
27
 
31
 
28
    /**
32
    /**
29
     * DSA secret exponent x
33
     * DSA secret exponent x
30
     *
34
     *
31
     * @var \phpseclib3\Math\BigInteger
35
     * @var \phpseclib3\Math\BigInteger
-
 
36
     * @access private
32
     */
37
     */
33
    protected $x;
38
    protected $x;
34
 
39
 
35
    /**
40
    /**
36
     * Returns the public key
41
     * Returns the public key
Line 49... Line 54...
49
     * A PKCS1 public key corresponds to the publicKey portion of the PKCS8 key. In the case of RSA
54
     * A PKCS1 public key corresponds to the publicKey portion of the PKCS8 key. In the case of RSA
50
     * the publicKey portion /is/ the key. In the case of DSA it is not. You cannot verify a signature
55
     * the publicKey portion /is/ the key. In the case of DSA it is not. You cannot verify a signature
51
     * without the parameters and the PKCS1 DSA public key format does not include the parameters.
56
     * without the parameters and the PKCS1 DSA public key format does not include the parameters.
52
     *
57
     *
53
     * @see self::getPrivateKey()
58
     * @see self::getPrivateKey()
-
 
59
     * @access public
54
     * @return mixed
60
     * @return mixed
55
     */
61
     */
56
    public function getPublicKey()
62
    public function getPublicKey()
57
    {
63
    {
58
        $type = self::validatePlugin('Keys', 'PKCS8', 'savePublicKey');
64
        $type = self::validatePlugin('Keys', 'PKCS8', 'savePublicKey');
Line 70... Line 76...
70
 
76
 
71
    /**
77
    /**
72
     * Create a signature
78
     * Create a signature
73
     *
79
     *
74
     * @see self::verify()
80
     * @see self::verify()
-
 
81
     * @access public
75
     * @param string $message
82
     * @param string $message
76
     * @return mixed
83
     * @return mixed
77
     */
84
     */
78
    public function sign($message)
85
    public function sign($message)
79
    {
86
    {