PublicKey

Extends\phpseclib3\Crypt\DSA Implements\phpseclib3\Crypt\Common\PublicKey

DSA Public Key

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

Create public / private key pair.

createKey(array<mixed,integer> $args): \phpseclib3\Crypt\DSA\PrivateKey
inheritedstatic

This method is a bit polymorphic. It can take a DSA/Parameters object, L / N as two distinct parameters or no parameters (at which point L and N will be generated with this method)

Returns the private key, from which the publickey can be extracted

Arguments

$args

array<mixed,integer>

Response

\phpseclib3\Crypt\DSA\PrivateKey

Create DSA parameters

createParameters(integer $L = 2048,integer $N = 224): \phpseclib3\Crypt\DSA|boolean
inheritedstatic

Arguments

$L

integer

$N

integer

Response

\phpseclib3\Crypt\DSA|boolean

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 current engine being used

getEngine(): string
inherited
see self::useInternalEngine()self::useBestEngine()

Response

string

Returns the public key's fingerprint

getFingerprint(string $algorithm = 'md5'): mixed
inherited

The public key's fingerprint is returned, which is equivalent to running ssh-keygen -lf rsa.pub. If there is no public key currently loaded, false is returned. Example output (md5): "c1:b1:30:29:d7:b8:de:6c:97:77:10:d7:46:41:63:87" (as specified by RFC 4716)

Arguments

$algorithm

string

The hashing algorithm to be used. Valid options are 'md5' and 'sha256'. False is returned for invalid values.

Response

mixed

Returns the hash algorithm currently being used

getHash()
inherited

Returns the key size

getLength(): array
inherited

More specifically, this L (the length of DSA Prime P) and N (the length of DSA Group Order q)

Response

array

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 the signature format currently being used

getSignatureFormat()
inherited

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

Verify a signature

verify(string $message,string $signature): mixed
see \phpseclib3\Crypt\DSA\PublicKey::verify()

Arguments

$message

string

$signature

string

Response

mixed

Determines which hashing function should be used

withHash(string $hash)
inherited

Arguments

$hash

string

Determines the signature padding mode

withSignatureFormat(string $format)
inherited

Valid values are: ASN1, SSH2, Raw

Arguments

$format

string

Constants

Algorithm Name

ALGORITHM
inherited
var

Properties

DSA Prime P

p :\phpseclib3\Math\BigInteger
inherited

DSA Group Order q

q :\phpseclib3\Math\BigInteger
inherited

Prime divisor of p-1

var

Type(s)

\phpseclib3\Math\BigInteger

DSA Group Generator G

g :\phpseclib3\Math\BigInteger
inherited

DSA public key value y

y :\phpseclib3\Math\BigInteger
inherited

Signature Format

sigFormat :string
inherited
var

Type(s)

string

Signature Format (Short)

shortFormat :string
inherited
var

Type(s)

string

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