File manager - Edit - /home/opticamezl/www/newok/Signer.zip
Back
PK !�\�fX X Hmac/Sha384.phpnu �[��� <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Signer\Hmac; use Lcobucci\JWT\Signer\Hmac; /** * Signer for HMAC SHA-384 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 0.1.0 */ class Sha384 extends Hmac { /** * {@inheritdoc} */ public function getAlgorithmId() { return 'HS384'; } /** * {@inheritdoc} */ public function getAlgorithm() { return 'sha384'; } } PK !�\�: X X Hmac/Sha512.phpnu �[��� <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Signer\Hmac; use Lcobucci\JWT\Signer\Hmac; /** * Signer for HMAC SHA-512 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 0.1.0 */ class Sha512 extends Hmac { /** * {@inheritdoc} */ public function getAlgorithmId() { return 'HS512'; } /** * {@inheritdoc} */ public function getAlgorithm() { return 'sha512'; } } PK !�\�p{SX X Hmac/Sha256.phpnu �[��� <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Signer\Hmac; use Lcobucci\JWT\Signer\Hmac; /** * Signer for HMAC SHA-256 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 0.1.0 */ class Sha256 extends Hmac { /** * {@inheritdoc} */ public function getAlgorithmId() { return 'HS256'; } /** * {@inheritdoc} */ public function getAlgorithm() { return 'sha256'; } } PK !�\���ִ � OpenSSL.phpnu �[��� <?php namespace Lcobucci\JWT\Signer; use InvalidArgumentException; use function is_resource; use function openssl_error_string; use function openssl_free_key; use function openssl_pkey_get_details; use function openssl_pkey_get_private; use function openssl_pkey_get_public; use function openssl_sign; use function openssl_verify; abstract class OpenSSL extends BaseSigner { public function createHash($payload, Key $key) { $privateKey = $this->getPrivateKey($key->getContent(), $key->getPassphrase()); try { $signature = ''; if (! openssl_sign($payload, $signature, $privateKey, $this->getAlgorithm())) { throw CannotSignPayload::errorHappened(openssl_error_string()); } return $signature; } finally { openssl_free_key($privateKey); } } /** * @param string $pem * @param string $passphrase * * @return resource */ private function getPrivateKey($pem, $passphrase) { $privateKey = openssl_pkey_get_private($pem, $passphrase); $this->validateKey($privateKey); return $privateKey; } /** * @param $expected * @param $payload * @param $key * @return bool */ public function doVerify($expected, $payload, Key $key) { $publicKey = $this->getPublicKey($key->getContent()); $result = openssl_verify($payload, $expected, $publicKey, $this->getAlgorithm()); openssl_free_key($publicKey); return $result === 1; } /** * @param string $pem * * @return resource */ private function getPublicKey($pem) { $publicKey = openssl_pkey_get_public($pem); $this->validateKey($publicKey); return $publicKey; } /** * Raises an exception when the key type is not the expected type * * @param resource|bool $key * * @throws InvalidArgumentException */ private function validateKey($key) { if (! is_resource($key)) { throw InvalidKeyProvided::cannotBeParsed(openssl_error_string()); } $details = openssl_pkey_get_details($key); if (! isset($details['key']) || $details['type'] !== $this->getKeyType()) { throw InvalidKeyProvided::incompatibleKey(); } } /** * Returns the type of key to be used to create/verify the signature (using OpenSSL constants) * * @internal */ abstract public function getKeyType(); /** * Returns which algorithm to be used to create/verify the signature (using OpenSSL constants) * * @internal */ abstract public function getAlgorithm(); } PK !�\�¿�o o BaseSigner.phpnu �[��� <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Signer; use Lcobucci\JWT\Signature; use Lcobucci\JWT\Signer; use function trigger_error; use const E_USER_DEPRECATED; /** * Base class for signers * * @deprecated This class will be removed on v4 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 0.1.0 */ abstract class BaseSigner implements Signer { /** * {@inheritdoc} */ public function modifyHeader(array &$headers) { $headers['alg'] = $this->getAlgorithmId(); } /** * {@inheritdoc} */ public function sign($payload, $key) { return new Signature($this->createHash($payload, $this->getKey($key))); } /** * {@inheritdoc} */ public function verify($expected, $payload, $key) { return $this->doVerify($expected, $payload, $this->getKey($key)); } /** * @param Key|string $key * * @return Key */ private function getKey($key) { if (is_string($key)) { trigger_error('Implicit conversion of keys from strings is deprecated. Please use InMemory or LocalFileReference classes.', E_USER_DEPRECATED); $key = new Key($key); } return $key; } /** * Creates a hash with the given data * * @internal * * @param string $payload * @param Key $key * * @return string */ abstract public function createHash($payload, Key $key); /** * Performs the signature verification * * @internal * * @param string $expected * @param string $payload * @param Key $key * * @return boolean */ abstract public function doVerify($expected, $payload, Key $key); } PK !�\_KM�| | Ecdsa/ConversionFailed.phpnu �[��� <?php namespace Lcobucci\JWT\Signer\Ecdsa; use InvalidArgumentException; use Lcobucci\JWT\Exception; final class ConversionFailed extends InvalidArgumentException implements Exception { /** @return self */ public static function invalidLength() { return new self('Invalid signature length.'); } /** @return self */ public static function incorrectStartSequence() { return new self('Invalid data. Should start with a sequence.'); } /** @return self */ public static function integerExpected() { return new self('Invalid data. Should contain an integer.'); } } PK !�\��&� � Ecdsa/Sha512.phpnu �[��� <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Signer\Ecdsa; use Lcobucci\JWT\Signer\Ecdsa; /** * Signer for ECDSA SHA-512 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.1.0 */ class Sha512 extends Ecdsa { /** * {@inheritdoc} */ public function getAlgorithmId() { return 'ES512'; } /** * {@inheritdoc} */ public function getAlgorithm() { return 'sha512'; } /** * {@inheritdoc} */ public function getKeyLength() { return 132; } } PK !�\H1��� � Ecdsa/Sha256.phpnu �[��� <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Signer\Ecdsa; use Lcobucci\JWT\Signer\Ecdsa; /** * Signer for ECDSA SHA-256 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.1.0 */ class Sha256 extends Ecdsa { /** * {@inheritdoc} */ public function getAlgorithmId() { return 'ES256'; } /** * {@inheritdoc} */ public function getAlgorithm() { return 'sha256'; } /** * {@inheritdoc} */ public function getKeyLength() { return 64; } } PK !�\dR � � Ecdsa/SignatureConverter.phpnu �[��� <?php namespace Lcobucci\JWT\Signer\Ecdsa; /** * Manipulates the result of a ECDSA signature (points R and S) according to the * JWA specs. * * OpenSSL creates a signature using the ASN.1 format and, according the JWA specs, * the signature for JWTs must be the concatenated values of points R and S (in * big-endian octet order). * * @internal * * @see https://tools.ietf.org/html/rfc7518#page-9 * @see https://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One */ interface SignatureConverter { /** * Converts the signature generated by OpenSSL into what JWA defines * * @param string $signature * @param int $length * * @return string */ public function fromAsn1($signature, $length); /** * Converts the JWA signature into something OpenSSL understands * * @param string $points * @param int $length * * @return string */ public function toAsn1($points, $length); } PK !�\�B��� � Ecdsa/Sha384.phpnu �[��� <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Signer\Ecdsa; use Lcobucci\JWT\Signer\Ecdsa; /** * Signer for ECDSA SHA-384 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.1.0 */ class Sha384 extends Ecdsa { /** * {@inheritdoc} */ public function getAlgorithmId() { return 'ES384'; } /** * {@inheritdoc} */ public function getAlgorithm() { return 'sha384'; } /** * {@inheritdoc} */ public function getKeyLength() { return 96; } } PK !�\GτJ� � "