PHP Classes

File: test/KeyPairTest.php

Recommend this page to a friend!
  Packages of Scott Arciszewski   Easy PHP RSA Library   test/KeyPairTest.php   Download  
File: test/KeyPairTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Easy PHP RSA Library
RSA data encryption and decryption using phpseclib
Author: By
Last change:
Date: 5 years ago
Size: 786 bytes
 

Contents

Class file image Download
<?php
use \ParagonIE\EasyRSA\KeyPair;

class KeyPairTest extends PHPUnit_Framework_TestCase
{
    public function testBasicFunctions()
    {
        $kp = KeyPair::generateKeyPair(2048);
        $private = $kp->getPrivateKey();
        $public = $kp->getPublicKey();
        $this->assertEquals(
            $kp->getPublicKey()->getKey(),
            $public->getKey()
        );

        $this->assertEquals(
            $private->getPublicKey()->getKey(),
            $public->getKey()
        );

        $kp2 = new KeyPair($private);
        $this->assertEquals(
            $kp->getPublicKey()->getKey(),
            $kp2->getPublicKey()->getKey()
        );

        $this->assertEquals(
            $kp2->getPublicKey()->getKey(),
            $public->getKey()
        );
    }
}