SJCL: Searchable Encryption
Searchable symmetric encryption (SSE) allows a party to outsource the storage of his data to another party in a private manner, while maintaining the ability to selectively search over it.
Applications: (Basically anything that involves tagging or querying private data.)
- Outsourcing functionality like spam detection and search to a backend server in encrypted email services.
- Raw data and file storage.
coffee -c ./searchable.coffee
Regardless of what filetype is in use, an appropriately compiled
sjcl.js should always be loaded before this library is.
This implementation of SSE is intended for the browser, while caesar's implementation can be used on the backend! Also, there are a lot of naunces to using SSE that would be better understood by reading over the example, reading caesar's documentation, or reading the paper itself, rather than making me try to explain it.
sjcl.searchable.tokenize(corpus)- The basic, stock tokenizer. Takes a corpus and returns the array of unique words it contains without caps or punctuation.
corpus- Body of text to be tokenized. (
- Returns the tokenized corpus. (
sjcl.searchable.secureIndex(keystore, max, indexes...)- Encrypts a data's index so that it can be sent to an untrusted party.
keystore- The unencrypted keystore. Will be changed by the function! (
max- The size in bytes of the largest document in the collection. (
indexes...- The indexes to be secured. The first index can be an array generated by a tokenizer, but the rest after that need to be in proper form (the form provided by the server).
- Returns an object containing:
newId- A new, randomly generated id. Only useful if the functionality discussed above is utilized. (
newDomain- A new, ranodmly generated domain name. Always useful, since this will always create a new domain. (
index- The secured index, which can be published to the server. (
sjcl.searchable.createQuery(keystore, tokens...)- Encrypts a query so that it can be sent to an untrusted party.
keystore- The unencrypted keystore. (
tokens...- The individual tokens to generate queries for. (
- Returns an array of objects, where each object is a query for an individual token. (