public function testSignature() { $this->keypair1 = new Keypair(); $this->private1 = $this->keypair1->getPrivateKey(); $this->public1 = $this->keypair1->getPublicKey(); $this->keypair2 = new KeyPair($this->private1, $this->public1); $this->assertEquals(1, Signature::verifySignature('testmessage', $this->public1, Signature::createSignature('testmessage', $this->private1))); $this->assertEquals(1, Signature::verifySignature('testmessage', $this->keypair2->getPublicKey(), Signature::createSignature('testmessage', $this->private1))); $this->assertEquals(0, Signature::verifySignature('othertestmessage', $this->public1, Signature::createSignature('testmessage', $this->private1))); }
public function signRequest($privateAccountKey) { $this->headers[SONIC_HEADER__SIGNATURE] = Signature::createSignature($this->getStringForRequestSignature(), $privateAccountKey); }
private function sign($personalPrivateKey) { $this->signature = Signature::createSignature($this->getStringForSignature(), $personalPrivateKey); }