PHP Classes

File: test/CustomValidator.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Certainty  >  test/CustomValidator.php  >  Download  
File: test/CustomValidator.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Certainty
Manage SSL certificate authority file used by PHP
Author: By
Last change:
Date: 3 years ago
Size: 949 bytes
 

Contents

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

use
ParagonIE\Certainty\Bundle;
use
ParagonIE\Certainty\Validator;
use
ParagonIE\ConstantTime\Hex;

/**
 * Class CustomValidator
 *
 * For unit tests only!
 *
 * @package ParagonIE\Certainty\Tests
 */
class CustomValidator extends Validator
{
   
/**
     * @var string
     */
   
public static $publicKey = '';

   
/**
     * @param $string
     */
   
public static function setPublicKey($string)
    {
       
self::$publicKey = $string;
    }

   
/**
     * @param Bundle $bundle Which bundle to validate
     * @param bool $backupKey Use the backup key? (Only if the primary is compromsied.)
     * @return bool
     */
   
public static function checkEd25519Signature(Bundle $bundle, $backupKey = false)
    {
        return \
ParagonIE_Sodium_File::verify(
           
$bundle->getSignature(true),
           
$bundle->getFilePath(),
           
Hex::decode(self::$publicKey)
        );
    }
}

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