![](https://puvox.software/blog/wp-content/uploads/sites/2/2020/05/encrypt-decrypt.png)
We have been using some simple approaches to securely transfer messages between PHP
and C#
. We published our method here on github:
https://github.com/ttodua/useful-php-scripts/blob/master/two-way-encrypt-decrypt-PHP-C_sharp
Note, you can use the code not only between PHP-C# communication, but also with each other (PHP-PHP, C#-C#);
Examples:
You can simple output some string from PHP:
echo EncryptDecrypt::EncryptString ( "Hello message to C#", "mySecretKey123" );
and then read it in C# :
Console.WriteLine( EncryptDecrypt::DecryptString ( encryptedStringFromPhp, "mySecretKey123" ) );
Of course, you can do conversely, encrypt message from C# and send to PHP .
p.s. If you also need other kind of encrypt solution solely for PHP, check this code.