PHP Classes

File: src/Kludge.php

Recommend this page to a friend!
  Packages of Scott Arciszewski   Easy PHP RSA Library   src/Kludge.php   Download  
File: src/Kludge.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: 492 bytes
 

Contents

Class file image Download
<?php
namespace ParagonIE\EasyRSA;

use Defuse\Crypto\Key;

class Kludge
{
    /**
     * Use an internally generated key in a Defuse context
     *
     * @param string $randomBytes
     * @return Key
     */
    public function defuseKey($randomBytes)
    {
        $key = Key::createNewRandomKey();
        $func = function ($bytes) {
            $this->key_bytes = $bytes;
        };
        $helper = $func->bindTo($key, $key);
        $helper($randomBytes);
        return $key;
    }
}