!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/main_file/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/   drwxr-xr-x
Free 12.99 GB of 57.97 GB (22.41%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Raw.php (5.57 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/**
 * Raw RSA Key Handler
 *
 * PHP version 5
 *
 * An array containing two \phpseclib3\Math\BigInteger objects.
 *
 * The exponent can be indexed with any of the following:
 *
 * 0, e, exponent, publicExponent
 *
 * The modulus can be indexed with any of the following:
 *
 * 1, n, modulo, modulus
 *
 * @author    Jim Wigginton <terrafrost@php.net>
 * @copyright 2015 Jim Wigginton
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
 * @link      http://phpseclib.sourceforge.net
 */

namespace phpseclib3\Crypt\RSA\Formats\Keys;

use 
phpseclib3\Math\BigInteger;

/**
 * Raw RSA Key Handler
 *
 * @author  Jim Wigginton <terrafrost@php.net>
 */
abstract class Raw
{
    
/**
     * Break a public or private key down into its constituent components
     *
     * @param string $key
     * @param string $password optional
     * @return array
     */
    
public static function load($key$password '')
    {
        if (!
is_array($key)) {
            throw new 
\UnexpectedValueException('Key should be a array - not a ' gettype($key));
        }

        
$key array_change_key_case($keyCASE_LOWER);

        
$components = ['isPublicKey' => false];

        foreach ([
'e''exponent''publicexponent'0'privateexponent''d'] as $index) {
            if (isset(
$key[$index])) {
                
$components['publicExponent'] = $key[$index];
                break;
            }
        }

        foreach ([
'n''modulo''modulus'1] as $index) {
            if (isset(
$key[$index])) {
                
$components['modulus'] = $key[$index];
                break;
            }
        }

        if (!isset(
$components['publicExponent']) || !isset($components['modulus'])) {
            throw new 
\UnexpectedValueException('Modulus / exponent not present');
        }

        if (isset(
$key['primes'])) {
            
$components['primes'] = $key['primes'];
        } elseif (isset(
$key['p']) && isset($key['q'])) {
            
$indices = [
                [
'p''q'],
                [
'prime1''prime2']
            ];
            foreach (
$indices as $index) {
                list(
$i0$i1) = $index;
                if (isset(
$key[$i0]) && isset($key[$i1])) {
                    
$components['primes'] = [=> $key[$i0], $key[$i1]];
                }
            }
        }

        if (isset(
$key['exponents'])) {
            
$components['exponents'] = $key['exponents'];
        } else {
            
$indices = [
                [
'dp''dq'],
                [
'exponent1''exponent2']
            ];
            foreach (
$indices as $index) {
                list(
$i0$i1) = $index;
                if (isset(
$key[$i0]) && isset($key[$i1])) {
                    
$components['exponents'] = [=> $key[$i0], $key[$i1]];
                }
            }
        }

        if (isset(
$key['coefficients'])) {
            
$components['coefficients'] = $key['coefficients'];
        } else {
            foreach ([
'inverseq''q\'''coefficient'] as $index) {
                if (isset(
$key[$index])) {
                    
$components['coefficients'] = [=> $key[$index]];
                }
            }
        }

        if (!isset(
$components['primes'])) {
            
$components['isPublicKey'] = true;
            return 
$components;
        }

        if (!isset(
$components['exponents'])) {
            
$one = new BigInteger(1);
            
$temp $components['primes'][1]->subtract($one);
            
$exponents = [=> $components['publicExponent']->modInverse($temp)];
            
$temp $components['primes'][2]->subtract($one);
            
$exponents[] = $components['publicExponent']->modInverse($temp);
            
$components['exponents'] = $exponents;
        }

        if (!isset(
$components['coefficients'])) {
            
$components['coefficients'] = [=> $components['primes'][2]->modInverse($components['primes'][1])];
        }

        foreach ([
'privateexponent''d'] as $index) {
            if (isset(
$key[$index])) {
                
$components['privateExponent'] = $key[$index];
                break;
            }
        }

        return 
$components;
    }

    
/**
     * Convert a private key to the appropriate format.
     *
     * @param \phpseclib3\Math\BigInteger $n
     * @param \phpseclib3\Math\BigInteger $e
     * @param \phpseclib3\Math\BigInteger $d
     * @param array $primes
     * @param array $exponents
     * @param array $coefficients
     * @param string $password optional
     * @param array $options optional
     * @return array
     */
    
public static function savePrivateKey(BigInteger $nBigInteger $eBigInteger $d, array $primes, array $exponents, array $coefficients$password '', array $options = [])
    {
        if (!empty(
$password) && is_string($password)) {
            throw new 
UnsupportedFormatException('Raw private keys do not support encryption');
        }

        return [
            
'e' => clone $e,
            
'n' => clone $n,
            
'd' => clone $d,
            
'primes' => array_map(function ($var) {
                return clone 
$var;
            }, 
$primes),
            
'exponents' => array_map(function ($var) {
                return clone 
$var;
            }, 
$exponents),
            
'coefficients' => array_map(function ($var) {
                return clone 
$var;
            }, 
$coefficients)
        ];
    }

    
/**
     * Convert a public key to the appropriate format
     *
     * @param \phpseclib3\Math\BigInteger $n
     * @param \phpseclib3\Math\BigInteger $e
     * @return array
     */
    
public static function savePublicKey(BigInteger $nBigInteger $e)
    {
        return [
'e' => clone $e'n' => clone $n];
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0058 ]--