4.1. Keystore

As stated in the Threat Model, Keystore is a trusted server where users can publish their public keys. You can assume that attackers cannot overwrite any entry you add to the Keystore.

Keystore is structured as a key-value store. In this context, key refers to an unique identifier that is used to index the value in the database, and does not refer to a crypographic key.

An implementation of Keystore is provided for you (see source code in userlib) and is already imported into client.go.

The client application can interact with Keystore using the API documented below.

KeystoreSet(key string, value PKEEncKey/DSVerifyKey) (error)

Stores the given value (public cryptographic key) at the given storage key.

Key-value entries into Keystore are immutable. Any attempt to modify an existing key-value entry will return an error.

Notice that the required type of value is a single public cryptographic key; KeystoreSet cannot store any other type of data.

Parameters
  • key (string) – Unique identifier used to index value in the database.

  • value (PKEEncKey/DSVerifyKey) – Public (cryptographic) encryption/verification key.

Return type

error

KeystoreGet(key string) (value PKEEncKey/DSVerifyKey, ok bool)

Return the value (public cryptographic key) at the given storage key.

If a value does exist at the given storage key, then ok will be true; otherwise it will be false.

Parameters

key (string) – Unique identifier used to index value in the database.

Return type

PKEEncKey/DSVerifyKey, bool