micseres/micro-service-dh

微服务Diffie-Hellman

1.1.0 2021-04-20 07:46 UTC

This package is auto-updated.

Last update: 2024-09-20 15:01:39 UTC


README

使用说明

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)

许可证

软删除包是开源软件,遵循MIT许可证