Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php rsa encryption

// Use phpseclib: http://phpseclib.sourceforge.net/
<?php
include('Crypt/RSA.php');

$privatekey = file_get_contents('private.key');
$rsa = new Crypt_RSA();
$rsa->loadKey($privatekey);

$plaintext = new Math_BigInteger('aaaaaa');
echo $rsa->_exponentiate($plaintext)->toBytes();
?>
Comment

php RSA encryption

<?php

$publicKey = file_get_contents("public.key");
$textToEncrypt = "My Plain Text" ;
$cipherType = "RSA/ECB/PKCS1Padding"; //RSA, RSA/ECB/OAEPWithSHA-1AndMGF1Padding


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://www.devglan.com/online-tools/rsa-encrypt',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "textToEncrypt": "'.$textToEncrypt.'",
    "publicKey": "'.$publicKey.'",
    "keyType": "publicKeyForEncryption",
    "cipherType": "'.$cipherType.'"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

?>
Comment

PREVIOUS NEXT
Code Example
Php :: password_hash 
Php :: symfony redirect to previous page 
Php :: merge two query results in laravel 
Php :: php loop object 
Php :: faker laravel 
Php :: php check if any of multiple values in array 
Php :: mpdf output 
Php :: php float round 
Php :: validation error message in laravel 
Php :: lcomposer symfony/filesystem 
Php :: exec command not working in php but works in terminal 
Php :: php random number generator 
Php :: html_entity_decode (PHP 4 = 4.3.0, PHP 5, PHP 7, PHP 8) html_entity_decode — Convert HTML entities to their corresponding characters 
Php :: Str laravel 9 
Php :: laravel get data from this year 
Php :: laravel get auth user id 
Php :: read pdf text in php 
Php :: laravel collection transform 
Php :: delete mysql php 
Php :: scribe laravel 
Php :: use js in php 
Php :: ubuntu install php 8 nginx 
Php :: set unique value validation for laravel form request 
Php :: laravel multiple orderby 
Php :: php button to another page 
Php :: php session destroy 
Php :: aapanel ubuntu 20.04 
Php :: string convert snake case to title case in laravel 
Php :: fetch data from live website curl php 
Php :: exec output php 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =