Encrypted SynthDef

Hi All,
Hoping for some insight, Here is my goal:

  1. Write a synthdef.
  2. Compile it.
  3. Encrypt the compiled definition.
  4. Send the encrypted file to a user.
  5. Allow the user to decrypt and load the synthdef while exposing the decrypted data to as little inspection as possible.

I am not looking for something that’s unhackable, just less conveniently accessible than saving the decrypted file to disk.

What I have found is the following:

  1. The method .writeDefFile of the SynthDef class seems to compile the synth def and save it to disk. The format is semi-human-readable, and does not appear to be the sort of data that belongs in a buffer.
  2. The server command \d_recv appears to load a synthdef from a buffer.

What I do not know:

  1. The format of the data in the buffer to be loaded by \d_recv.
  2. A method to compile a synthdef into a buffer. ( or translate a .scsyndef file into a buffer )

Any help/information would be very appreciated!
-Kevin Warren

That’s not quite true – no buffers are involved in d_recv at all. (Edit: The Server Command Reference refers to a buffer – I think, though, that this is really an OSC “blob” datatype and that the term “buffer” in the reference is not correct. It’s easy to imagine that a help author might have had type tag “b” in mind and fetched the wrong word from memory.)

d_recv embeds exactly the same binary format that is written to disk, e.g. s.sendMsg(\d_recv, aSynthDefObject.asBytes).

hjh

Thanks so much, HJH, this is exactly the info I was looking for.
Best,
Kevin Warren