AsymmetricKey

Base Class for all asymmetric cipher classes

author

Jim Wigginton terrafrost@php.net

package

Default

Methods

The constructor

__construct()

__toString() magic method

__toString(): string

Response

string

Add a fileformat plugin

addFileFormat(string $fullname): boolean
static

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

Arguments

$in

string

Response

\phpseclib3\Math\BigInteger

Bit String to Octet String

bits2octets(string $in): string

Arguments

$in

string

Response

string

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

computek(string $h1): string

Arguments

$h1

string

Response

string

Returns the key's comment

getComment(): null|string

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()

Returns the format of the loaded key.

getLoadedFormat(): mixed

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 a list of supported formats.

getSupportedKeyFormats(): array
static

Response

array

Initialize static variables

initialize_static_variables()
static

Integer to Octet String

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

Arguments

Response

string

Load the key

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

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
static

Arguments

$type

string

$key

string

$password

string

optional

Response

static

Loads parameters

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

Arguments

$key

string|array

Response

\phpseclib3\Crypt\Common\AsymmetricKey

Loads parameters

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

Arguments

$type

string

$key

string|array

Response

\phpseclib3\Crypt\Common\AsymmetricKey

Load Plugins

loadPlugins(string $format)
static

Arguments

$format

string

Loads a private key

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

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
static

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
static

Arguments

$key

string|array

Response

\phpseclib3\Crypt\Common\PublicKey

Loads a public key

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

Arguments

$type

string

$key

string

Response

\phpseclib3\Crypt\Common\PublicKey

toString

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

Arguments

$type

string

$options

array

Response

string

Tests engine validity

useBestEngine()
static

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

useInternalEngine()
static

Validate Plugin

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

Arguments

$format

string

$type

string

$method

string

optional

Response

mixed

Determines which hashing function should be used

withHash(string $hash)

Arguments

$hash

string

Properties

Precomputed Zero

zero :\phpseclib3\Math\BigInteger
static

Precomputed One

one :\phpseclib3\Math\BigInteger
static

Format of the loaded key

format :string
var

Type(s)

string

Hash function

hash :\phpseclib3\Crypt\Hash

HMAC function

hmac :\phpseclib3\Crypt\Hash

Supported plugins (lower case)

plugins :array
static
see
var

Type(s)

array

Invisible plugins

invisiblePlugins :array
static
see
var

Type(s)

array

Available Engines

engines :array<mixed,boolean>
static
var

Type(s)

array<mixed,boolean>

Key Comment

comment :null|string
var

Type(s)

null|string