PHP Classes

File: tests/unit/BoxSealTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   PHP Sodium Compat   tests/unit/BoxSealTest.php   Download  
File: tests/unit/BoxSealTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Sodium Compat
Cryptographic functions of libsodium in pure PHP
Author: By
Last change:
Date: 1 year ago
Size: 651 bytes
 

Contents

Class file image Download
<?php

class BoxSealTest extends PHPUnit_Framework_TestCase
{
   
/**
     * @before
     */
   
public function before()
    {
       
ParagonIE_Sodium_Compat::$disableFallbackForUnitTests = true;
    }

    public function
testSeal()
    {
       
$keypair = ParagonIE_Sodium_Compat::crypto_box_keypair();
       
$pk = ParagonIE_Sodium_Compat::crypto_box_publickey($keypair);

       
$message = "This is a secret test message!\0\n";
       
$sealed = ParagonIE_Sodium_Compat::crypto_box_seal($message, $pk);
       
$opened = ParagonIE_Sodium_Compat::crypto_box_seal_open($sealed, $keypair);

       
$this->assertSame($opened, $message);
    }
}