File: test/SignatureTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Easy PHP RSA Library  >  test/SignatureTest.php  >  Download  
File: test/SignatureTest.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: 2 months ago
Size: 515 bytes
 

Contents

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

class
SignatureTest extends PHPUnit_Framework_TestCase
{
    public function
testSign()
    {
       
$keyPair = KeyPair::generateKeyPair(2048);
           
$secretKey = $keyPair->getPrivateKey();
           
$publicKey = $keyPair->getPublicKey();
       
       
$plain = 'This is a message.';
       
$signature = EasyRSA::sign($plain, $secretKey);
       
       
$this->assertTrue(EasyRSA::verify($plain, $signature, $publicKey));
    }
}


For more information send a message to info at phpclasses dot org.