コード例 #1
0
 public function getErroneousTypeVectors()
 {
     $context = TestCase::getContext();
     $array = array();
     $class = new self();
     $resource = openssl_pkey_new();
     return array(array($context, $array), array($context, $resource), array($context, $class));
 }
コード例 #2
0
 public function getErroneousTypeVectors()
 {
     $private = $this->pack('17a2209250b59f07a25b560aa09cb395a183eb260797c0396b82904f918518d5');
     $msg32 = $this->pack('0af79b2b747548d59a4a765fb73a72bc4208d00b43d0606c13d332d5c284b0ef');
     $context = TestCase::getContext();
     $array = array();
     $class = new Secp256k1EcdsaSignTest();
     $resource = openssl_pkey_new();
     return array(array($context, $array, $private), array($context, $msg32, $array), array($context, $resource, $private), array($context, $msg32, $resource), array($context, $class, $private), array($context, $msg32, $class));
 }
コード例 #3
0
 public function testVerifyWithInvalidInput()
 {
     $context = TestCase::getContext();
     $private = $this->pack('17a2209250b59f07a25b560aa09cb395a183eb260797c0396b82904f918518d5');
     $msg32 = $this->pack('0af79b2b747548d59a4a765fb73a72bc4208d00b43d0606c13d332d5c284b0ef');
     $sig = $this->pack('304502206af189487988df26eb4c2b2c7d74b78e19822bbb2fc27dada0800019abd20b46022100f0e6c4dabd4970afe125f707fbd6d62e79e950bdb2b4b9700214779ae475b05d');
     /** @var resource $s */
     $s = '';
     secp256k1_ecdsa_signature_parse_der($context, $sig, $s);
     /** @var resource $public */
     $public = '';
     $this->assertEquals(1, \secp256k1_ec_pubkey_create($context, $private, $public), 'public');
     $this->assertEquals(1, \secp256k1_ecdsa_verify($context, $msg32, $s, $public), 'initial check');
     $this->assertEquals(0, \secp256k1_ecdsa_verify($context, '', $s, $public), 'msg32 as empty string');
     $this->assertEquals(0, \secp256k1_ecdsa_verify($context, 1, $s, $public), 'msg32 as 1');
 }
コード例 #4
0
 /**
  * @expectedException \Exception
  */
 public function testEnforceZvalString()
 {
     $tweak = $this->pack('0af79b2b747548d59a4a765fb73a72bc4208d00b43d0606c13d332d5c284b0ef');
     $privateKey = array();
     \secp256k1_ec_privkey_tweak_add(TestCase::getContext(), $privateKey, $tweak);
 }