\Horde_Pgp_Crypt_DSA

DSA (Digital Signature Algorithm) implementation.

Summary

Methods
Properties
Constants
randomNumber()
__construct()
generate()
sign()
verify()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$_key
N/A

Properties

$_key

$_key : \OpenPGP_PublicKeyPacket

Public/private key packet.

Type

\OpenPGP_PublicKeyPacket

Methods

randomNumber()

randomNumber(\phpseclib\Math\BigInteger  $q) : \phpseclib\Math\BigInteger

Generate a number that lies between 0 and q-1.

Parameters

\phpseclib\Math\BigInteger $q

Max number.

Returns

\phpseclib\Math\BigInteger —

Generated number.

__construct()

__construct(\OpenPGP_PublicKeyPacket  $key) 

Constructor.

Parameters

\OpenPGP_PublicKeyPacket $key

Key data.

generate()

generate(\phpseclib\Math\BigInteger  $p, \phpseclib\Math\BigInteger  $q, \phpseclib\Math\BigInteger  $g) : array

DSA keypair creation.

Parameters

\phpseclib\Math\BigInteger $p

p

\phpseclib\Math\BigInteger $q

q

\phpseclib\Math\BigInteger $g

g

Returns

array —

Keys:

  • x: (\phpseclib\Math\BigInteger) Private key.
  • y: (\phpseclib\Math\BigInteger) Public key.

sign()

sign(string  $message, string  $hash_alg) : array

DSA sign.

Parameters

string $message

Message.

string $hash_alg

Hash algorithm.

Returns

array —

r,s key

verify()

verify(string  $message, string  $hash_alg, \phpseclib\Math\BigInteger  $r, \phpseclib\Math\BigInteger  $s) : boolean

DSA verify.

Parameters

string $message

Message.

string $hash_alg

Hash algorithm.

\phpseclib\Math\BigInteger $r

r.

\phpseclib\Math\BigInteger $s

s.

Returns

boolean —

True if verified.