Commit Graph
435 Commits
Author SHA1 Message Date
Adil El Farissi c2eb8083cb Revert "Re-sync repo"
This reverts commit 1c214566f3.
2024-08-21 02:52:29 +00:00
Adil El Farissi 1c214566f3 Re-sync repo 2024-08-21 00:20:35 +00:00
Adil El Farissi 6ab23c8d6b Merge branch 'opensim:master' into master 2024-06-07 21:03:53 +00:00
UbitUmarov 30586b34f6 replace Util.Clamp<T>() 2024-06-04 09:01:10 +01:00
UbitUmarov 57c1e15428 use hash.HashData() and other cosmetics 2024-05-10 13:05:50 +01:00
UbitUmarov 5330c8fcca mantis 9127 add missing linksetdata serializer 2024-05-08 18:01:38 +01:00
UbitUmarov 8e6eeb1931 let the socketAddress cache be global 2024-04-27 15:47:33 +01:00
Adil El Farissi 681baf65f1 Basic implementation of SSL selfsigned certificates creation and renewal
Allows selfsigned certificates creation and renewal for local and external use. When enabled, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificates in SSL\ssl\ folder. Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true.

Note: The SSL related params in the network section was adapted to be user friendly and allow the usage just by uncommenting the SSL params in both sections and a password change.
2024-03-20 01:12:49 +00:00
AdilElFarissi 3542d5461b Merge branch 'opensim:master' into master 2024-03-19 21:50:59 +00:00
UbitUmarov 6905f1a71a cosmetics 2024-03-10 16:56:12 +00:00
Adil El FarissiandUbit Umarov df8fe33007 Last cosmetics and PHP/LSL test scripts
All is working fine :)

The following script send a request to the PHP file where the encrypted  string using osAESEncrypt() is decrypted and re-encrypted using the PHP openssl_XXXX. the return is the original string and the re-encrypted separated by "|"... the script decrypt the returned re-encrypted using osAESDecrypt() and log it in the chat.

LSL script:
<pre><code>
// Change the url to point to your PHP file.
string url =  "http://127.0.0.1/aesTest.php";
string plainText = "Hello World :)";
string secret = "#!qUeRtY$@123^456€!#";
key r_id;

default
{
    touch_start(integer i)
    {
        string encryptedText = osAESEncrypt(secret, plainText);
        llOwnerSay("\nEncrypted with osAESEncrypt:\n"+ encryptedText);

        r_id = llHTTPRequest(url, [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded",HTTP_BODY_MAXLENGTH,"16384"], "data="+ encryptedText);
    }

    http_response(key id, integer status, list metaData, string Response){
        if(status = 200 ){
            if(id == r_id){
                if(Response != ""){
                    list temp = llParseString2List(Response,"|",[]);
                    llOwnerSay("\nDecrypted using PHP openssl_decrypt:\n"+ llList2String(temp,0));
                    llOwnerSay("\nEncrypted using PHP openssl_encrypt:\n"+ llList2String(temp,1));
                    string decryptedText = osAESDecrypt(secret, llList2String(temp,1));
                    llOwnerSay("\nDecrypted with osAESDecrypt from PHP:\n"+ decryptedText);
                }
                else{
                    llOwnerSay("Enc/Dec Failed! Response:\n"+ Response);
                }
            }
        }
        else{
             llOwnerSay("Destination not available.\nstatus: "+ status);
        }
    }
}
</code></pre>

The PHP file:
<pre><code>
<?php
    if(getenv('REQUEST_METHOD') == 'POST') {
	    $script_data = file_get_contents("php://input");
        if($script_data){
            $data = $_POST['data'];
            $secret = "#!qUeRtY$@123^456€!#";
            $key = hex2bin(strtoupper(hash('sha256', $secret)));
            $iv = hex2bin(strtoupper(explode(":", $data)[0]));
            $encryptedText = hex2bin(strtoupper(explode(":", $data)[1]));
            $plainText = openssl_decrypt($encryptedText, "AES-256-CBC", $key, $options=OPENSSL_RAW_DATA, $iv);
            $retIv = openssl_random_pseudo_bytes(16);
            $reEncrypted = openssl_encrypt($plainText, "AES-256-CBC", $key, $options=OPENSSL_RAW_DATA, $retIv);

            echo $plainText && $reEncrypted ? $plainText."|".bin2hex($retIv).":".bin2hex($reEncrypted) : "";

        }
    };
?>
</code></pre>

Co-Authored-By: Ubit Umarov <469643+UbitUmarov@users.noreply.github.com>
2024-02-29 01:09:20 +00:00
UbitUmarov ab4b690ffd fis AES encoding 2024-02-27 20:21:35 +00:00
UbitUmarov eb9afdaffc break them a bit more... 2024-02-24 15:47:06 +00:00
UbitUmarov 121f270414 a few changes to last PR (aes methods) - all still untested 2024-02-24 14:50:54 +00:00
Adil El Farissi db80781e7d Basic implementation of AES encryption/decryption and respective OSSL functions
Add methods:
+ private static string AESEncryptString(string secret, string plainText, string ivString= null)
AES Encrypt a string using a password and a random or custom Initialization Vector.

+ private static string AESDecryptString(string secret, string encryptedText, string ivString= null)
AES Decrypt the string encrypted by AESEncryptString with the same password and ivString used in the encryption.

Methods implementations:
+ Util.AESEncrypt(string secret, string plainText)
+ Util.AESDecrypt(string secret, string encryptedText)
+Util.AESEncryptTo(string secret, string plainText, string ivString)
+ Util.AESDecryptFrom(string secret, string encryptedText, string ivString)

OSSL functions as first case of use:
+ osAESEncrypt(string secret, string plainText)
+ osAESDecrypt(string secret, string encryptedText)
+ osAESEncryptTo(string secret, string plainText, string ivString)
+ osAESDecryptFrom(string secret, string encryptedText, string ivString)

LSL script example:
<pre><code>
string plainText = "Hello World :)";
string secret = "#!qUeRtY$@123^456€!#";

default
{
    touch_start(integer i)
    {
        string encryptedText = osAESEncrypt(secret, plainText);
        llOwnerSay("\nEncrypted with osAESEncrypt:\n"+ encryptedText);
        string decryptedText = osAESDecrypt(secret, encryptedText);
        llOwnerSay("\nDecrypted with osAESDecrypt:\n"+ decryptedText);

        // Encription / Decription with custom Initialization Vector.
        string ivString = (string)llGetOwner() /* +"_"+ llGenerateKey() */;
        string encryptedToText = osAESEncryptTo(secret, plainText, ivString);
        llOwnerSay("\nEncrypted with osAESEncryptTo:\n"+ encryptedToText);
        string decryptedFromText = osAESDecryptFrom(secret, encryptedToText, ivString);
        llOwnerSay("\nDecrypted with osAESDecryptFrom:\n"+ decryptedFromText);
    }
}
</code></pre>

Web Rain :)
2024-02-23 21:14:33 +00:00
UbitUmarov f1cba63aad retire StringToBytes variants with string format. Do the format before calling.. 2024-02-05 18:34:44 +00:00
UbitUmarov db04234685 update libomv 2024-02-05 18:07:57 +00:00
UbitUmarov f21aca428f do not auto set reflection_probe_ambiance on old skies, so a viewer can decide to fix for pbr (ofc seems tha currently they just set it 0 and do nothing showing broke skies in same cases); a few changes on notecards uuid detection 2024-01-10 13:30:14 +00:00
UbitUmarov e950c502ad change share of almost empty class httpclient, to just share of used SocketsHttpHandler, This simpifies handling of timeout, otherwise problematic 2023-05-26 20:27:24 +01:00
UbitUmarov 5e0c6446d8 update xmlrpc.dll with a send variant using httpclint and used it 2023-05-24 13:42:56 +01:00
UbitUmarov 19229aff64 replace HttpWebRequest by HttpClient on another place 2023-05-16 22:57:23 +01:00
UbitUmarov 7dbedecd88 add LSL llLinear2sRGB and llsRGB2Linear 2023-04-28 01:55:35 +01:00
UbitUmarov b1f2a5b661 a few test changes 2023-03-09 08:26:12 +00:00
UbitUmarov e5386fba6f use NativeLibrary.TryLoad() instead of dllimported load 2022-11-22 22:22:44 +00:00
UbitUmarov dad22a822e use possible hardware accelerated System.Numerics.BitOperations.Log2(n) 2022-11-22 22:19:24 +00:00
UbitUmarov 8685ebe655 try fix osx detection than ms keeps breaking 2022-11-16 00:20:37 +00:00
UbitUmarov d9380c9b83 clean some spurius chars and a few other things. Thanks Vincent Sylvester 2022-11-12 02:49:01 +00:00
UbitUmarov f5883d8ce6 revert introduction of some in arguments 2022-10-23 21:00:56 +01:00
UbitUmarov d27516ac01 cosmetics 2022-10-22 22:51:55 +01:00
UbitUmarov a28c875ce4 add llSHA256String() same as osSHA256 2022-10-22 14:10:07 +01:00
UbitUmarov fddb3761a0 use some shared char arrays on string split 2022-10-19 01:38:25 +01:00
UbitUmarov 8895577c80 use Random.Shared 2022-10-16 15:06:36 +01:00
UbitUmarov e4a158327a some use of interpolated strings 2022-10-05 01:53:24 +01:00
UbitUmarov bf257a937b change runtime information log, add processor arch to ossl/lsl sim version 2022-10-03 22:43:58 +01:00
UbitUmarov b87ba5449c a little use of MathF 2022-10-03 16:29:22 +01:00
UbitUmarov d6a2541179 use some more new c# sugar ( possible breaking it all :P ) 2022-10-03 16:16:36 +01:00
UbitUmarov b687a3604c change the platform strings to DotNet 2022-10-02 15:34:51 +01:00
UbitUmarov cce98b18c0 betterrandom was not that better 2022-10-02 11:42:07 +01:00
UbitUmarov b4c057c80c cosmetics 2022-09-18 14:07:53 +01:00
UbitUmarov 0505fd54e4 simplify CleanString a bit more 2022-09-14 18:41:13 +01:00
UbitUmarov 772cce51b6 avoid a future dotnet bug they will not fix 2022-09-13 22:52:09 +01:00
UbitUmarov d545506efc add a few more parameters to llGetObjectDetails(); add intger log2(uint) 2022-08-23 17:27:02 +01:00
UbitUmarov b140e9d2e9 seems null strings may reach Parse*UniversalUserIdentifier 2022-04-02 16:47:45 +01:00
UbitUmarov 497262e452 also revert ParseUniversalUserIdentifier to its original form, possivle making a useless Substring 2022-03-27 23:51:33 +01:00
UbitUmarov fd7d0128fe other spot 2022-03-27 22:22:44 +01:00
UbitUmarov 846d2df245 replace util.clip by utils.clamp (from libomv), and a few more cosmetics 2022-03-18 02:20:40 +00:00
UbitUmarov 073098e1b6 a few more changes on universal id 2022-03-15 02:03:06 +00:00
UbitUmarov 5e1306ea7c cosmetics: indent etc 2022-03-15 01:15:28 +00:00
UbitUmarov 5f687b71ec s few changes to Parse universal id 2022-03-15 00:49:32 +00:00
UbitUmarov a85f1792df avid some spurius space on avatar uui 2022-02-02 01:52:33 +00:00