Skip to content

Instantly share code, notes, and snippets.

@sshine
Created October 9, 2014 13:20
Show Gist options
  • Save sshine/393be1f4d854eab72d30 to your computer and use it in GitHub Desktop.
Save sshine/393be1f4d854eab72d30 to your computer and use it in GitHub Desktop.
Keyserver exercise
Keyservers:
A keyserver is a repository for cryptographic keys. A person can upload their
keys to a keyserver, and other persons can retrieve the key if they want to
send them an encrypted message.
To avoid a keyserver being compromised, several keyservers can be connected
and share their databases. So if one server has its keys changed, the other
servers can
Each key, by the way, has a "hash" (some number) that with some probability is
the only hash for that particular key. Such hashes are useful because they can
be remembered by humans. Also, a keyserver can be asked of a key by giving its
hash.
A key has the form {key, N}, and an identity has the form {id, M}, where N is
just a big number, and M is some string (e.g. "Simon Shine <[email protected]>").
Implement the following API:
Function name Return value Blocking?
-------------------------------------------------------------------------------
keyserver:start() -> {ok, ServerPid}
keyserver:put(ServerPid, Id, Key) -> true / false
keyserver:get(ServerPid, Id) -> {found, Key} / notfound
keyserver:connect(FromPid, ToPid) -> true / false
keyserver:checkHealth(ServerPid) -> ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment