micseres/micro-service-dh

Micro Service Diffie Hellman

1.1.0 2021-04-20 07:46 UTC

This package is auto-updated.

Last update: 2024-03-20 13:49:15 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.