$keyPairSize
$keyPairSize :
The key pair size in bytes length property storage.
Class KeyExchange - The key exchange protocol object, based on the Diffie-Hellman algorithm.
$keyExpansionSource : \CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction|null
The key expansion derivation algorithm service property storage.
setKeyExpansionFunction(\CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction $hasher) : $this
Setter for the key expansion derivation service.
\CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction | $hasher | The key expansion derivation service or null. |
The container object.
getKeyExpansionFunction() : \CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction|null
Getter for the key expansion derivation service.
The currently injected key expansion derivation service or null.
__construct(\CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction|null $hasher = null)
Container constructor.
\CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction|null | $hasher | The message key expansion derivation service. |
Initialization validation.
generateExchangeRequestInformation() : \CryptoManana\DataStructures\ExchangeInformation
Generates fresh key exchange information for sending to the remote party.
Validation errors.
The key exchange information object.
generateExchangeResponseInformation(string $prime, string $generator) : \CryptoManana\DataStructures\ExchangeInformation
Generates fresh key exchange information based on the received prime and generator values.
string | $prime | The hexadecimal representation of a prime number, also knows as |
string | $generator | The hexadecimal generator number, a primitive root modulo of |
Validation errors.
The key exchange information object.
computeSharedSecret(string $remotePublicKey, string $localPrivateKey) : string
Computes the secret shared key for usage of both parties.
string | $remotePublicKey | The remote side's public key, based on the same prime and generator combination. |
string | $localPrivateKey | The local side's private key, based on the same prime and generator combination. |
Validation errors.
The shared secret key.
generateKeyPairResource(array $settings) : resource
Internal method for generating a new key pair resource base on the given configuration.
array | $settings | The key generation configuration settings. |
Validation or system errors.
The private key resource containing all necessary information (prime, generator and public key).
getKeyPairInformation(resource $privateKeyResource) : array
Internal method for extracting the key pair details from from the private key resource.
resource | $privateKeyResource | The private key resource. |
Validation or system errors.
The key pair details as an array.
exportPrivateKeyString(resource $privateKeyResource) : string
Internal method for exporting the private key as a Base64 string from the private key resource.
resource | $privateKeyResource | The private key resource. |
Validation or system errors.
The exported private key as a Base64 string.
generateKeyPair(null|string $prime = null, null|string $generator = null) : array
Generates fresh Diffie–Hellman key exchange information.
null|string | $prime | The hexadecimal representation of a prime number or null to generate a new one. |
null|string | $generator | The hexadecimal representation of a generator number or null to generate a new one. |
Validation or generation errors.
The generated key pair information.
buildExchangeInformation(null|string $prime = null, null|string $generator = null) : \CryptoManana\DataStructures\ExchangeInformation
Generates and builds a key exchange information object.
null|string | $prime | The hexadecimal representation of a prime number or null to generate a new one. |
null|string | $generator | The hexadecimal representation of a generator number or null to generate a new one. |
Validation or generation errors.
The key exchange information object.