[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freenet-dev
Subject:    [Freenet-dev] Proposal: Subspace definition language
From:       Ian Clarke <ian () dynamicblue ! com>
Date:       2000-06-12 17:46:19
[Download RAW message or body]


In an effort to allay people's worries about the difficulty of
using a generalized language for definition of subspaces, here is a
description of a simple non-Turing language that could do the job.

But before the good stuff - just to give an idea of the interface to
the subspace system - we would need a method:

/**
 * @param parent The data as returned when the parent string is
 *               requested
 * @param childMD The metadata associated with the data which we hope
 *                to place in our datastore
 * @param childData The data we hope to place in the datastore
 * @return true if and only if the data has been validated against the
 *              parent
public abstract boolean validate(String parent, MetadataStore childMD, 
                        String childData);

The language itself would be stack based, and initially would have no
flow-control statements (although these could be added in a later
version).  The first line of the parent spec would be "Subspace 0.1"
indicating the version of the subspacing language used.  If this is
greater than that supported by the node, then the node should reject
all data with that kind of parent.  The user can also place limits on 
the maximum stack size, and maximum size of the parent spec.

The language is treated as a list of symbols separated by a whitespace
symbol, and supports '"' to delimit strings (which have the usual
C style escaping for strings).  Data is considered ok to store if and
only if a 1 is left on the stack after the program completes.

Commands supported in version 0.1 would be the following:
 
"xxxx"     - any string is pushed onto the stack
12345      - any integer is pushed onto the stack
12.23      - any floating point number is pushed onto the stack
concat     - Pulls two strings off the stack, joins them into
	     one string, and push them back onto the stack
pushmeta   - Pulls a string off the stack and pushes the
	     metadata associated with that string back
             onto the stack
pushdata   - Pushes the data onto the stack as a string
pushthis   - Pushes the parent data onto the stack as a string (ie.
	     the text of this program file itself)
versig     - Pulls a public key, a signature, and a string off the
	     stack, and pushes a 1 back on if the signature is the
	     result of signing the string with the public key, if
             not a 0 is pushed
and        - Pulls two items onto the stack and pushes a 1 if and
	     only if both are 1s, if not a 0 is pushed.
or         - Pulls two items onto the stack and pushes a 1 if either
	     is a 1.
not        - Pulls an item off the stack and returns a 1 if it wasn't
  	     1, and a 0 if it was.
equals     - Pulls two items off the stack and returns 1 if and only
             if they were equal, returning 0 if not.
startswith - Pulls two strings off the stack and returns 1 if and only
	     if the second starts with the first, returning 0 otherwise.
contains   - As above but checks that the second contains the first
endswith   - Opposite of startswith


Thus, if "abcde" were my public key, then I could create a private
subspace using:

--snip--
Subspace 0.1
"abcde" "SSSignature" pushmeta pushdata versig
--snip--

Here SSSignature is the signature obtained after signing the data with
my private key, which can be verified using "abcde", my public key.

If I wanted others to be able to add data using their keys provided
they had been signed by mine I could use:

--snip--
Subspace 0.1
"SSPubkey" pushmeta "SSSignature" pushmeta pushdata versig 
"abcde" "SSPubkeySig" pushmeta "SSPubkey" pushmeta 
and
--snip--

Here "SSPubkey" is the public key of a person to whom I have
delegated responsibility for this subspace.  "SSSignature" is the data
signed against their public key, and "SSPubkeySig" is my signature of
their public key.

For one final example -

--snip--
Subspace 0.1
"SSPubkey" pushmeta "SSSignature" pushmeta pushdata versig 
"abcde" "SSPubkeySig" pushmeta "SSPubkey" pushmeta 
and
"Subspace 0.1" pushdata startswith not
pushthis pushdata equals
or
and
--snip--

It may not look friendly, but basically it ensures that the data is
correctly signed by the authors public key AND that if the data is
itself a subspace, then it must have the same text as this
specification.

I am sure others can specify other useful commands, but I think it
should be clear that this would be easy to implement, flexible, and
secure.

Ian.

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic