Parameters

Extends\phpseclib3\Crypt\DH

DH Parameters

author

Jim Wigginton terrafrost@php.net

package

Default

Methods

The constructor

__construct()
inherited

__toString() magic method

__toString(): string
inherited

Response

string

Add a fileformat plugin

addFileFormat(string $fullname): boolean
inheritedstatic

The plugin needs to either already be loaded or be auto-loadable. Loading a plugin whose shortname overwrite an existing shortname will overwrite the old plugin.

see \phpseclib3\Crypt\Common\AsymmetricKey::load()

Arguments

$fullname

string

Response

boolean

Bit String to Integer

bits2int(string $in): \phpseclib3\Math\BigInteger
inherited

Arguments

$in

string

Response

\phpseclib3\Math\BigInteger

Bit String to Octet String

bits2octets(string $in): string
inherited

Arguments

$in

string

Response

string

Compute the pseudorandom k for signature generation, using the process specified for deterministic DSA.

computek(string $h1): string
inherited

Arguments

$h1

string

Response

string

Compute Shared Secret

computeSecret(\phpseclib3\Crypt\DH\PrivateKey|\phpseclib3\Crypt\EC $private,\phpseclib3\Crypt\DH\PublicKey|\phpseclib3\Math\BigInteger|string $public): mixed
inheritedstatic

Create public / private key pair.

createKey(\phpseclib3\Crypt\DH\Parameters $params,integer $length): \phpseclib3\Crypt\DH\PrivateKey
inheritedstatic

The rationale for the second parameter is described in http://tools.ietf.org/html/rfc4419#section-6.2 :

"To increase the speed of the key exchange, both client and server may reduce the size of their private exponents. It should be at least twice as long as the key material that is generated from the shared secret. For more details, see the paper by van Oorschot and Wiener [VAN-OORSCHOT]."

$length is in bits

Arguments

$length

integer

optional

Response

\phpseclib3\Crypt\DH\PrivateKey

Create DH parameters

createParameters( $args): \phpseclib3\Crypt\DH\Parameters
inheritedstatic

This method is a bit polymorphic. It can take any of the following:

  • two BigInteger's (prime and base)
  • an integer representing the size of the prime in bits (the base is assumed to be 2)
  • a string (eg. diffie-hellman-group14-sha1)

Arguments

$args

Response

\phpseclib3\Crypt\DH\Parameters

Returns the key's comment

getComment(): null|string
inherited

Not all key formats support comments. If you want to set a comment use toString()

Response

null|string

Returns the hash algorithm currently being used

getHash()
inherited

Returns the format of the loaded key.

getLoadedFormat(): mixed
inherited

If the key that was loaded wasn't in a valid or if the key was auto-generated with RSA::createKey() then this will throw an exception.

see \phpseclib3\Crypt\Common\AsymmetricKey::load()

Response

mixed

Returns the parameters

getParameters(): mixed
inherited

A public / private key is only returned if the currently loaded "key" contains an x or y value.

see self::getPublicKey()

Response

mixed

Returns a list of supported formats.

getSupportedKeyFormats(): array
inheritedstatic

Response

array

Initialize static variables

initialize_static_variables()
inheritedstatic

Integer to Octet String

int2octets(\phpseclib3\Math\BigInteger $v): string
inherited

Arguments

Response

string

Load the key

load(string $key,string $password = false): \phpseclib3\Crypt\Common\AsymmetricKey
inheritedstatic

Arguments

$key

string

$password

string

optional

Response

\phpseclib3\Crypt\Common\AsymmetricKey

Load the key, assuming a specific format

loadFormat(string $type,string $key,string $password = false): static
inheritedstatic

Arguments

$type

string

$key

string

$password

string

optional

Response

static

Loads parameters

loadParameters(string|array $key): \phpseclib3\Crypt\Common\AsymmetricKey
inheritedstatic

Arguments

$key

string|array

Response

\phpseclib3\Crypt\Common\AsymmetricKey

Loads parameters

loadParametersFormat(string $type,string|array $key): \phpseclib3\Crypt\Common\AsymmetricKey
inheritedstatic

Arguments

$type

string

$key

string|array

Response

\phpseclib3\Crypt\Common\AsymmetricKey

Load Plugins

loadPlugins(string $format)
inheritedstatic

Arguments

$format

string

Loads a private key

loadPrivateKey(string|array $key,string $password = ''): \phpseclib3\Crypt\Common\PrivateKey
inheritedstatic

Arguments

$key

string|array

$password

string

optional

Response

\phpseclib3\Crypt\Common\PrivateKey

Loads a private key

loadPrivateKeyFormat(string $type,string $key,string $password = false): \phpseclib3\Crypt\Common\PrivateKey
inheritedstatic

Arguments

$type

string

$key

string

$password

string

optional

Response

\phpseclib3\Crypt\Common\PrivateKey

Loads a public key

loadPublicKey(string|array $key): \phpseclib3\Crypt\Common\PublicKey
inheritedstatic

Arguments

$key

string|array

Response

\phpseclib3\Crypt\Common\PublicKey

Loads a public key

loadPublicKeyFormat(string $type,string $key): \phpseclib3\Crypt\Common\PublicKey
inheritedstatic

Arguments

$type

string

$key

string

Response

\phpseclib3\Crypt\Common\PublicKey

OnLoad Handler

onLoad(array $components): boolean
inheritedstatic

Arguments

$components

array

Response

boolean

toString

toString(string $type,array $options = array()): string
inheritedabstract

Arguments

$type

string

$options

array

Response

string

Tests engine validity

useBestEngine()
inheritedstatic

Flag to use internal engine only (useful for unit testing)

useInternalEngine()
inheritedstatic

Validate Plugin

validatePlugin(string $format,string $type,string $method = null): mixed
inheritedstatic

Arguments

$format

string

$type

string

$method

string

optional

Response

mixed

Determines which hashing function should be used

withHash(string $hash)
inherited

Arguments

$hash

string

Constants

Algorithm Name

ALGORITHM
inherited
var

Properties

DH prime

prime :\phpseclib3\Math\BigInteger
inherited

DH Base

base :\phpseclib3\Math\BigInteger
inherited

Prime divisor of p-1

var

Type(s)

\phpseclib3\Math\BigInteger

Public Key

publicKey :\phpseclib3\Math\BigInteger
inherited

Precomputed Zero

zero :\phpseclib3\Math\BigInteger
inheritedstatic

Precomputed One

one :\phpseclib3\Math\BigInteger
inheritedstatic

Format of the loaded key

format :string
inherited
var

Type(s)

string

Hash function

hash :\phpseclib3\Crypt\Hash
inherited

HMAC function

hmac :\phpseclib3\Crypt\Hash
inherited

Supported plugins (lower case)

plugins :array
inheritedstatic
see
var

Type(s)

array

Invisible plugins

invisiblePlugins :array
inheritedstatic
see
var

Type(s)

array

Available Engines

engines :array<mixed,boolean>
inheritedstatic
var

Type(s)

array<mixed,boolean>

Key Comment

comment :null|string
inherited
var

Type(s)

null|string