Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Linked Message Communications

Jade Self
Registered User
Join date: 17 Mar 2008
Posts: 6
08-04-2008 09:03
Hi there,

I have been toying over this problem for a short while and thought it's about time I just asked.

I have split my script for a project into multiple scripts within one prim to allow for easier management of my code and a certain amount of reusability. In doing this I introduced llMessageLinked and link_message event. All works great and I can now communicate happily between these scripts using the LINK_THIS parameter.

My question is, can these messages be intercepted, or what is more my worry can someone inject messages into my scripts? If they can, can I determine the origin of the Link_Message and determine if it has come from one of my scripts, thereby negating it if it hasn't?

Should I be looking at some form of encryption in the communication?
Personally there is no sensitive data that exists in this object, however I am looking forward to a future project that involves money and reuses these scripts I have just separated.

thank you in advance,
Jade
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
08-04-2008 09:06
The scripts can be taken out and put into a modifiable prim. Check out this article aptly named "The L$100,000 Scripting Lesson" :D http://foo.secondlifeherald.com/slh/2007/06/the_l100000_scr.html
_____________________
Jade Self
Registered User
Join date: 17 Mar 2008
Posts: 6
08-05-2008 08:15
From: Day Oh
The scripts can be taken out and put into a modifiable prim. Check out this article aptly named "The L$100,000 Scripting Lesson" :D http://foo.secondlifeherald.com/slh/2007/06/the_l100000_scr.html


ty hun for your reply, a very interesting read. Taking this a little step further then, I can encrypt my communications between scripts, that not a problem, i have several methods I can do this with.

However as an added safety, would it not be advisable for me on startup to parse all objects in a linkset to make sure I was the creator. This way, if anyone does attempt to embed my script in their app, this I can see, and gracefully nerf the scripts. Or maybe the question im really asking is can creator be impersonated?

thanks
Jade
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
08-05-2008 09:02
Yea, though it is probably likely to be fixed/changed, you can indeed write whatever UUID you want in an item's creator field, regardless of permissions on that item, but even if that weren't so, you'd probably still not want to bet against anyone ever acquiring a full-perm object created by you.

Now we need a helpful response from someone who knows about encryptions :D
_____________________
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-05-2008 11:52
If you are really concerned about other scripts listening in, you'll want some kind of full encryption, probably using llXorBase64StringsCorrect() ultimately. How you come up with the padding to XOR is the big question. Some kind of RSA style algorithm used to generate a random seed that'll produce a one-time pad might be a good option.

However, if you are only worried about other scripts INJECTING messages, you only need authentication, not full encryption. I've done this before by using the last (key) parameter of all link messages for a signature produced using llMD5String() with a secret key and the other link message parameters. Something like (note: not yet compiled; may need a couple minor syntax fixes):

CODE

// Use your own secret values here; must be shared between scripts
string LINK_PASSPHRASE = "90348cu5q3498c5un34985uc34p95u";
integer LINK_NONCE = 1721212753;

string calculateSig(integer sendingPrim, integer intParam, string stringParam)
{
return
llMD5String(
llList2CSV([ LINK_PASSPHRASE, sendingPrim, intParam, stringParam ]),
LINK_NONCE);
}

sendMessage(integer destination, integer intParam, string stringParam)
{
string sig = calculateSig(llGetLinkNumber(), intParam, stringParam);

llMessageLinked(destination, intParam, stringParam, (key)sig);
}

integer verifyMessage(integer sendingPrim, integer intParam, string stringParam, key keyParam)
{
string sig = calculageSig(sendingPrim, intParam, stringParam);

return (sig == (string)keyParam);
}