PHP Classes
elePHPant
Icontem

File: tests/KeyProvider/ArrayProviderTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Cipher Sweet  >  tests/KeyProvider/ArrayProviderTest.php  >  Download  
File: tests/KeyProvider/ArrayProviderTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Cipher Sweet
Encrypt data in away that can be searched
Author: By
Last change:
Date: 6 months ago
Size: 912 bytes
 

Contents

Class file image Download
<?php
namespace ParagonIE\CipherSweet\Tests\KeyProvider;

use
ParagonIE\CipherSweet\Backend\ModernCrypto;
use
ParagonIE\CipherSweet\KeyProvider\ArrayProvider;
use
ParagonIE\ConstantTime\Hex;
use
PHPUnit\Framework\TestCase;

/**
 * Class ArrayProviderTest
 * @package ParagonIE\CipherSweet\Tests\KeyProvider
 */
class ArrayProviderTest extends TestCase
{
   
/**
     * @throws \ParagonIE\CipherSweet\Exception\ArrayKeyException
     * @throws \ParagonIE\CipherSweet\Exception\CryptoOperationException
     */
   
public function testHappyPath()
    {
       
$backend = new ModernCrypto();

       
$random = random_bytes(32);

       
$provider = new ArrayProvider($backend, [
           
ArrayProvider::INDEX_SYMMETRIC_KEY =>
               
$random
       
]);

       
$this->assertSame(
           
Hex::encode($random),
           
Hex::encode($provider->getSymmetricKey()->getRawKey())
        );
    }
}