- $this->assertEquals(8, strlen($test));
- $this->assertEquals(11111111, $test);
+ self::assertEquals(8, strlen($test));
+ self::assertEquals(11111111, $test);
+ }
+
+ public function dataRsa(): array
+ {
+ return [
+ 'diaspora' => [
+ 'key' => file_get_contents(__DIR__ . '/../../datasets/crypto/rsa/diaspora-public-rsa-base64'),
+ 'expected' => file_get_contents(__DIR__ . '/../../datasets/crypto/rsa/diaspora-public-pem'),
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider dataRsa
+ */
+ public function testPubRsaToMe(string $key, string $expected)
+ {
+ self::assertEquals($expected, Crypto::rsaToPem(base64_decode($key)));
+ }
+
+
+ public function dataPEM()
+ {
+ return [
+ 'diaspora' => [
+ 'key' => file_get_contents(__DIR__ . '/../../datasets/crypto/rsa/diaspora-public-pem'),
+ ],
+ ];