Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Asymmetric encryption in PHP

<?php
//Initiate the keys
$result = openssl_pkey_new(array("private_key_bits" => 4096));
//Export private key to $privateKey
openssl_pkey_export($result, $privateKey);
//Get the public key
$publicKey = openssl_pkey_get_details($result)['key'];
//Prepare your plain text to encrypt
$plaintext = "Welcome To Blogdesire";
//Encrypt and export encrypted value to $encrypted_text
openssl_public_encrypt($plaintext,$encrypted_text,$publicKey);
//Print encrypted text 
echo $encrypted_text;
//Decrypt the encrypted message using the private key
openssl_private_decrypt($encrypted_text, $plaintext, $privateKey);
//Print the decrypted message
echo $plaintext;
Comment

PREVIOUS NEXT
Code Example
Php :: laravel gigapay update invoice 
Php :: Create An Array Of Data With many Rows 
Php :: laravel collection makeVisible 
Php :: php mysql insert record if not exists in table 
Php :: get_user_info 
Php :: example of valid php variables 
Php :: Convert Shamsi Jalali Persian Date TimeStamp 
Php :: laravel read csv 
Php :: laravel query buider 
Php :: singular from table laravel 
Php :: typo3 add backend skin 
Php :: Yii2 hasMany relation additional condition 
Php :: php 8 jit does not work 
Php :: php curl upload linkedin image 
Php :: Date and time Asia karachi php 
Php :: Including ACF in a custom theme or plugin 
Php :: php messageformatter 
Php :: php array splice insert array in array 
Php :: how to payment credit card in codeigniter authorized.net 
Php :: withCount laravel assign generic name 
Php :: ifmodule condition in htaccess 
Php :: Loading an image using a PHP script 
Php :: laravel vu3 
Php :: file upload yii2 rest api 
Php :: wp_ajax_nopriv 
Php :: symfony translation variable in twig 
Php :: wp_query not have term 
Php :: laravel orm latest() 
Php :: Laravel Eloquent sum of multiplied columns 
Php :: add backslash to path wordpress 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =