ヤミRoot VoidGate
User / IP
:
216.73.216.143
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
api
/
src
/
AppBundle
/
Utils
/
Signer
/
Viewing: Signer.php
<?php namespace AppBundle\Utils\Signer; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Exception\IOExceptionInterface; class Signer { private $signingAlgo = OPENSSL_ALGO_SHA256; private $pki_api_cert_path; private $pki_api_key_path; private $pki_client_key_pass; public function __construct($pki_api_cert_path, $pki_api_key_path, $pki_client_key_pass) { $this->pki_api_cert_path = $pki_api_cert_path; $this->pki_api_key_path = $pki_api_key_path; $this->pki_client_key_pass = $pki_client_key_pass; } /** * Sign data with a private key * * @param string $data The data to be signed * @param string $privateKey The private key * @param string $passphrase The passphrase required for the private key * * @return string The signature. */ public function sign($data,$privateKey, $passphrase) { $fileSystem = new Filesystem(); try { $fileSystem->dumpFile("/tmp/etravel/key.pem", $privateKey); } catch (IOExceptionInterface $exception) { echo "An error occurred while creating your directory at ".$exception->getPath(); } $keyId = openssl_pkey_get_private("file:///tmp/etravel/key.pem", $passphrase); openssl_sign($data, $signature, $keyId , $this->signingAlgo); openssl_free_key($keyId); return $signature; } /** * Verify signature * * @param string $data The data previously signed * @param string $signature The signature previously calculated * @param string $cert The public key string * * @return boolean true if the signature and the data match */ public function verifySignature($data, $signature,$cert) { $fileSystem = new Filesystem(); try { $fileSystem->dumpFile("/tmp/etravel/cert.pem", $cert); } catch (IOExceptionInterface $exception) { echo "An error occurred while creating your directory at ".$exception->getPath(); } $keyId = openssl_pkey_get_public("file:///tmp/etravel/cert.pem"); $ok = openssl_verify($data, $signature, $keyId, $this->signingAlgo); openssl_free_key($keyId); return $ok? true: false; } /** * sign a ticket using the server's key */ public function signDataByServer($data) { $keyId = openssl_pkey_get_private("file://".$this->pki_api_key_path, $this->pki_client_key_pass); openssl_sign($data, $signature, $keyId , $this->signingAlgo); openssl_free_key($keyId); return $signature; } /** * check the validity of a ticket signed with the server's key */ public function checkDataSignedByServer($data, $signature) { $keyId = openssl_pkey_get_public("file://". $this->pki_api_cert_path); $ok = openssl_verify($data, $signature, $keyId, $this->signingAlgo); openssl_free_key($keyId); return $ok? true: false; } }
Coded With 💗 by
0x6ick