PHP Class Horde_Pgp_Crypt_DSA, horde

Author: TSURUOKA Naoya ([email protected])
Author: Benjamin Krämer ([email protected])
Author: Michael Slusarz ([email protected])
Show file Open project: horde/horde Class Usage Examples

Public Methods

Method Description
__construct ( OpenPGP_PublicKeyPacket $key ) Constructor.
generate ( phpseclib\Math\BigInteger $p, phpseclib\Math\BigInteger $q, phpseclib\Math\BigInteger $g ) : array DSA keypair creation.
randomNumber ( phpseclib\Math\BigInteger $q ) : phpseclib\Math\BigInteger Generate a number that lies between 0 and q-1.
sign ( string $message, string $hash_alg ) : array DSA sign.
verify ( string $message, string $hash_alg, phpseclib\Math\BigInteger $r, phpseclib\Math\BigInteger $s ) : boolean DSA verify.

Method Details

__construct() public method

Constructor.
public __construct ( OpenPGP_PublicKeyPacket $key )
$key OpenPGP_PublicKeyPacket Key data.

generate() public method

DSA keypair creation.
public generate ( phpseclib\Math\BigInteger $p, phpseclib\Math\BigInteger $q, phpseclib\Math\BigInteger $g ) : array
$p phpseclib\Math\BigInteger p
$q phpseclib\Math\BigInteger q
$g phpseclib\Math\BigInteger g
return array Keys: - x: (\phpseclib\Math\BigInteger) Private key. - y: (\phpseclib\Math\BigInteger) Public key.

randomNumber() public static method

Generate a number that lies between 0 and q-1.
public static randomNumber ( phpseclib\Math\BigInteger $q ) : phpseclib\Math\BigInteger
$q phpseclib\Math\BigInteger Max number.
return phpseclib\Math\BigInteger Generated number.

sign() public method

DSA sign.
public sign ( string $message, string $hash_alg ) : array
$message string Message.
$hash_alg string Hash algorithm.
return array r,s key

verify() public method

DSA verify.
public verify ( string $message, string $hash_alg, phpseclib\Math\BigInteger $r, phpseclib\Math\BigInteger $s ) : boolean
$message string Message.
$hash_alg string Hash algorithm.
$r phpseclib\Math\BigInteger r.
$s phpseclib\Math\BigInteger s.
return boolean True if verified.