micseres/micro-service-dh

Micro Service Diffie Hellman

1.0.0 2018-09-21 11:56 UTC

This package is auto-updated.

Last update: 2020-08-28 14:26:54 UTC


README

Usage

Alice

$this->dh = new DiffieHellman(true);

$requestToBob = [
    'p' => $this->dh->getPrime(),
    'g', $this->dh->getGenerator(),
    'public_key', $this->dh->getPublicKey()
];

//...

$pass = $this->dh->getSharedKey($responseFromBob->public_key)

Bob

$this->dh = new DiffieHellman(false);
$this->dh->generatePrimaryAsSlave($requestFromBob['p'], $requestFromBob['g']);
$pass = $this->dh->getSharedKey($requestFromBob->public_key)

License

The Soft Deletable Bundle is open-sourced software licensed under the MIT license.