Keystore ================================ As stated in the :doc:`../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 proj2.go_. The client application can interact with Keystore using the API documented below. .. function:: 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. :param key: Unique identifier used to index *value* in the database. :type key: string :param value: Public (cryptographic) encryption/verification key. :type value: PKEEncKey/DSVerifyKey :rtype: error .. function:: 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. :param key: Unique identifier used to index *value* in the database. :type key: string :rtype: PKEEncKey/DSVerifyKey, bool .. _userlib: https://github.com/cs161-staff/project2-userlib/blob/master/userlib.go .. _proj2.go: https://github.com/cs161-staff/project2-starter-code/blob/main/proj2.go .. _immutable: https://en.wikipedia.org/wiki/Immutable_object