/** * @depnds testGenerateWithoutException */ public function testIsValid() { $sinKey = new SinKey(); $this->assertNotNull($sinKey); $this->assertFalse($sinKey->isValid()); $pubKey = PublicKey::create(); $this->assertNotNull($pubKey); $pubKey->setPrivateKey(PrivateKey::create()->generate()); $pubKey->generate(); $sinKey->setPublicKey($pubKey); $sinKey->generate(); $this->assertTrue($sinKey->isValid()); }
/** * @depends testGenerate */ public function testToString() { $pubKey = new PublicKey(); $this->assertNotNull($pubKey); $pubKey->setPrivateKey(PrivateKey::create()->generate()); $this->assertSame('', (string) $pubKey); $pubKey->generate(PrivateKey::create()->generate()); if ('02' . $pubKey->getX() == $pubKey) { $compressed = '02' . $pubKey->getX(); } else { $compressed = '03' . $pubKey->getX(); } $this->assertSame($compressed, (string) $pubKey); $this->assertEquals(66, strlen((string) $pubKey)); }
public function testCreate() { $this->assertInstanceOf('Bitpay\\PrivateKey', PrivateKey::create()); }
/** * @group certificate * * @test * @expectedException \SAML2\Exception\InvalidArgumentException */ public function test_create_with_nonstring_password_throws_exception() { $key = \SAML2\CertificatesMock::getPlainPrivateKey(); PrivateKey::create($key, 1); }