<?php

namespace App\Console\Commands;

use App\Packages\Core\Service\CryptService;
use App\Packages\Phone\Service\PhoneParseService;
use App\Packages\Phone\Service\AmazonSmsService;
use Aws\Sns\Exception\SnsException;
use File;
use Illuminate\Console\Command;
use libphonenumber\PhoneNumber;
use phpseclib\Crypt\RSA;

/**
 * Class CryptCommand
 * @package App\Console\Commands
 */
class CryptCommand extends Command
{
    protected $signature = 'command:crypt';

    public function handle()
    {


        $string = CryptService::encryptString("Hello World");

//        dd($string);
//
        dd(CryptService::decryptString($string));


//
//        $crypt = new RSA();
//        $result = $crypt->createKey();
//
//
//        $rsa = new RSA();
//        $rsa->loadKey($result['publickey']); // public key
//
//        $plaintext = 'hello world';
//
//        $rsa->setEncryptionMode(RSA::ENCRYPTION_PKCS1);
//        $ciphertext = $rsa->encrypt($plaintext);
//
//        $rsa->loadKey($result['privatekey']); // private key
//
//
//        File::
//
//        File::put(base_path() . '/keys/public.key', $result['publickey']);
//        File::put(base_path() . '/keys/private.key', $result['privatekey']);


     //   echo $rsa->decrypt($ciphertext);

    }
}













