EcDH
in package
implements
EcDHInterface
This class is the implementation of ECDH.
EcDH is safe key exchange and achieves that a key is transported securely between two parties. The key then can be hashed and used as a basis in a dual encryption scheme, along with AES for faster two- way encryption.
Table of Contents
Interfaces
- EcDHInterface
- This is the contract for implementing EcDH (EC Diffie Hellman).
Properties
- $adapter : GmpMathInterface
- Adapter used for math calculations
- $recipientKey : PublicKeyInterface
- $secretKey : PublicKeyInterface
- Secret key between the two parties
- $senderKey : PrivateKeyInterface
Methods
- __construct() : mixed
- Initialize a new exchange from a generator point.
- calculateSharedKey() : GMP
- Calculates and returns the shared key for the exchange.
- createMultiPartyKey() : PublicKeyInterface
- setRecipientKey() : void
- Sets the recipient key.
- setSenderKey() : mixed
- Sets the sender's key.
- calculateKey() : mixed
- checkExchangeState() : mixed
- Verifies that the shared secret is known, or that the required keys are available to calculate the shared secret.
Properties
$adapter
Adapter used for math calculations
private
GmpMathInterface
$adapter
$recipientKey
private
PublicKeyInterface
$recipientKey
$secretKey
Secret key between the two parties
private
PublicKeyInterface
$secretKey
= null
$senderKey
private
PrivateKeyInterface
$senderKey
Methods
__construct()
Initialize a new exchange from a generator point.
public
__construct(GmpMathInterface $adapter) : mixed
Parameters
- $adapter : GmpMathInterface
-
A math adapter instance.
calculateSharedKey()
Calculates and returns the shared key for the exchange.
public
calculateSharedKey() : GMP
Tags
Return values
GMPcreateMultiPartyKey()
public
createMultiPartyKey() : PublicKeyInterface
Tags
Return values
PublicKeyInterfacesetRecipientKey()
Sets the recipient key.
public
setRecipientKey([PublicKeyInterface $key = null ]) : void
Parameters
- $key : PublicKeyInterface = null
Tags
setSenderKey()
Sets the sender's key.
public
setSenderKey(PrivateKeyInterface $key) : mixed
Parameters
- $key : PrivateKeyInterface
Tags
calculateKey()
private
calculateKey() : mixed
checkExchangeState()
Verifies that the shared secret is known, or that the required keys are available to calculate the shared secret.
private
checkExchangeState() : mixed