\CryptoManana\Core\Interfaces\ContainersKeyExchangeInterface

Interface KeyExchangeInterface - Interface specification for key exchange protocols.

Summary

Methods
Constants
setKeyExchangeSize()
getKeyExchangeSize()
generateExchangeRequestInformation()
generateExchangeResponseInformation()
computeSharedSecret()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

setKeyExchangeSize()

setKeyExchangeSize(integer  $keySize) 

Setter for the key pair size property.

Parameters

integer $keySize

The key pair size in bits.

Throws

\Exception

Validation errors.

getKeyExchangeSize()

getKeyExchangeSize() : integer

Getter for the key pair size property.

Returns

integer —

The key pair size in bits.

generateExchangeRequestInformation()

generateExchangeRequestInformation() : \CryptoManana\DataStructures\ExchangeInformation

Generates fresh key exchange information for sending to the remote party.

Throws

\Exception

Validation errors.

Returns

\CryptoManana\DataStructures\ExchangeInformation

The key exchange information object.

generateExchangeResponseInformation()

generateExchangeResponseInformation(string  $prime, string  $generator) : \CryptoManana\DataStructures\ExchangeInformation

Generates fresh key exchange information based on the received prime and generator values.

Parameters

string $prime

The hexadecimal representation of a prime number, also knows as p.

string $generator

The hexadecimal generator number, a primitive root modulo of p, also known as g.

Throws

\Exception

Validation errors.

Returns

\CryptoManana\DataStructures\ExchangeInformation

The key exchange information object.

computeSharedSecret()

computeSharedSecret(string  $remotePublicKey, string  $localPrivateKey) : string

Computes the secret shared key for usage of both parties.

Parameters

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.

Throws

\Exception

Validation errors.

Returns

string —

The shared secret key.