예제 #1
0
 public function testCrossPlatformDiffieHellman()
 {
     $privateKey = '686308ed8b6626c6e83b34d7fbfb44e0d46a9a876b6e37711cddb6474ee839e1';
     $publicKey = '03d1dee0824bc8de9bc4320268c308ae0f25e85ab8a8be83be01b43992eafcbc3c';
     $diffieHellman = ECC::diffieHellman($publicKey, $privateKey);
     $this->assertEquals('027ac2a4bdac427eeab40fcd2ae0e3eee8fd48124b5524c9a8793614bb869c14d7', $diffieHellman);
 }
예제 #2
0
 public function calculateSymmetricKey($publicKey = null, $deriveKey = true)
 {
     if ($publicKey == null) {
         $publicKey = $this->getPublicKey();
     }
     $diffieHellman = ECC::diffieHellman($publicKey, $this->getPrivateKey());
     if ($deriveKey) {
         return AES::deriveKey($diffieHellman);
     }
     return $diffieHellman;
 }