From da27cc6ce3f81faf7f7baa9c48b11d5f0bc52951 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 22 Aug 2018 22:45:25 -0600 Subject: [PATCH] Add Crypto Unit Test --- tests/Unit/CryptoTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/Unit/CryptoTest.php diff --git a/tests/Unit/CryptoTest.php b/tests/Unit/CryptoTest.php new file mode 100644 index 000000000..15ecac713 --- /dev/null +++ b/tests/Unit/CryptoTest.php @@ -0,0 +1,31 @@ +assertTrue(class_exists('\phpseclib\Crypt\RSA')); + } + + public function testRSASigning() + { + $rsa = new \phpseclib\Crypt\RSA(); + extract($rsa->createKey()); + $rsa->loadKey($privatekey); + $plaintext = 'pixelfed rsa test'; + $signature = $rsa->sign($plaintext); + $rsa->loadKey($publickey); + $this->assertTrue($rsa->verify($plaintext, $signature)); + } +}